0

我在 Hellosign 注册了一个应用程序,并在本地用于 django 项目。

OAuth由于我使用的是本地主机,因此在重新绑定应用程序时它需要域 url 进行回调,我给出了一个由https://ngrok.com/生成的回调 url 。

喜欢:https://1a2df3ef.ngrok.com/test/oauth

Django oauth url映射就像

url(r'^hellosign/oauth', 'hellosignup_oauth'),

看法

def hellosignup_oauth(request):
    code = request.GET.get('code')
    return render(request, 'hello.html', {'code': code})

授权后,会发出如下请求

https://1a2df3ef.ngrok.com/test/oauth?&code=17c2264f2a24741c&state=900e06e2

并且 ngrok 收到了这样的请求

 hellosign/oauth

似乎有两个问题:

1) ngrok 应该接收请求hellosign/oauth?&code=17c2264f2a24741c&state=900e06e2而不是hellosign/oauth.

2)hellosign/oauth视图没有被请求调用hellosign/oauth

有什么见解吗?

4

1 回答 1

0

这应该不是问题,但看起来您有一个空的 URL 参数(即“?&”)。可能是 Django 看到空的第一个参数并删除了第二个参数?

于 2014-08-01T16:45:36.170 回答