【发布时间】:2019-11-09 01:05:43
【问题描述】:
我已经构建了一个烧瓶应用程序,该应用程序使用 flask_dance's google blueprint 授权用户
我想使用该用户的授权通过GCS Client访问 GCS
如何转换
requests_oauthlib.OAuth2Session(由flask_dance返回)
到google.auth.credentials.Credentials(谷歌云库需要)这将使这成为可能?
OAuth2Session 中的令牌如下所示:
{
'id_token': 'eyJh....',
'access_token': 'ya29.Glw....',
'expires_at': 1561605616.261379,
'expires_in': 3573.162272,
'scope': [
'https://www.googleapis.com/auth/userinfo.email',
'openid',
'https://www.googleapis.com/auth/cloud-platform',
'https://www.googleapis.com/auth/userinfo.profile'
],
'token_type': 'Bearer'
}
【问题讨论】:
标签: python oauth-2.0 google-cloud-platform python-requests google-oauth