请看下面的代码:
@login_required
def dashboard(request):
code = request.GET.get('code', '')
payload = {
"client_id" : settings.GITHUB_CLIENT_ID,
"client_secret" : settings.GITHUB_CLIENT_SECRET,
"code" : code,
"state" : settings.STATE,
}
response = requests.post('https://github.com/login/oauth/access_token', params=payload)
# final_response = requests.get('https://api.github.com/user', auth=GitHubTokenAuth(access_token))
return HttpResponse(response)
# authenticated_user = final_response.json()
# return render(request, 'core/dashboard.html', {'authenticated_user':authenticated_user})
该response
变量返回的值类似于:
access_token=eiwfbvdsvefieebrferferwfreferfersfwrb&scope=a%20list%20of%20scopes&token_type=bearer
如何访问 的值,access_token
以便我可以使用注释掉final_response
变量的值?感谢期待!