从Django请求OAuth 2承载令牌

时间:2018-12-04 09:18:35

标签: python django oauth-2.0

enter image description here

我正在Django中工作。我需要访问外部API以获得访问令牌。我可以从邮递员连接(参见图片)。我提供了以下信息

Access_Token_url : http://{doamin-name}/auth/token
Client_ID: {client_id}
Client_secret: {client_secret}
Scope : {sapmle-scope}

我如何请求从Django获取访问令牌?

我尝试了

oauth2_handler = OAuth2(client_id = client_id, client_secret = client_secret, site=token_url, redirect_uri ='http://localhost:444/api/v1/taitodata/', token_url=token_url, scope_sep=scopes)
code = request.get("code")
parameters = oauth2_handler.get_token(code='code')
return Response(response)

0 个答案:

没有答案