我正在用django编写一个视图,这样用户就可以访问github并访问他们的存储库。你知道吗
import requests
def Authenticated_user(request):
if request.method == 'GET':
req = requests.get('https://github.com/login/oauth/authorize',
params = {
'client_id': 'something',
'redirect_uri': 'localhost:8000/app/',
'scope': 'user,public_repo,user:email.user:follow',
}
)
content = req.content
return HttpResponse(content)
这会让我进入登录页面,但问题是当我登录时,它会将我重定向到http://localhost:8000/session
,而不是http://localhost:8000/app/
。
我也试过这个
req = requests.get('https://github.com/login/oauth/authorize?client_id=something&redirect_uri=localhost:8000/app&scope=something,something
但是得到了同样的结果。 我不明白问题是什么。请帮帮我。 我还想知道如何使用oauth2的“代码”,这是我成功登录后得到的。你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐