我已经启动了示例-oauth-server,并尝试执行隐式流-我遵循了文档中的说明,并执行了以下操作
步骤1-注册客户端;确保不需要客户端机密。步骤2-打开REPL并执行以下操作
>>> from authlib.client import OAuth2Session
>>> client_id = 'MY CLIENT ID'
>>> scope = 'profile' # we want to fetch user's email
>>> session = OAuth2Session(client_id, scope=scope)
>>> authorize_url = 'http://localhost:5000/oauth/authorize'
>>> uri, state = session.authorization_url(authorize_url,response_type='token')下一步是获取授权响应。我似乎不能理解。print(uri)不会在URL响应中提供访问令牌,因为它不是授权响应。
我知道我需要给session.fetch_access_token(authorization_response);打电话
我的困惑是,当我没有得到authorization_response时,我应该把什么传递给fetch_access_token。
我知道我错过了一些次要的东西。任何建议。
发布于 2018-04-25 21:29:33
打印从authorization_url获得的uri,并在浏览器中访问此uri。在浏览器中,授予您的授权,它将重定向回您配置的redirect_uri。
重定向完成后,您将获得一个authorization_response。
记住使用"none“token_endpoint_auth_method创建客户端。
https://stackoverflow.com/questions/50011933
复制相似问题