I am writing a view in django so that it take a user to github and get access of their repositories and all.
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)
this is taking me to login page but the problem is when I logged in, it redirects me to http://localhost:8000/session instead of http://localhost:8000/app/.
I tried this also
req = requests.get('https://github.com/login/oauth/authorize?client_id=something&redirect_uri=localhost:8000/app&scope=something,something
but getting the same result.
I am not getting what's the problem is. please help me.
And also I want to know how to use that "code" for oauth2 which I will get after successfully logging in.