obtain_user_auth.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:google-auth-library-python 作者: GoogleCloudPlatform 项目源码 文件源码
def main():
    flow = client.flow_from_clientsecrets(CLIENT_SECRETS_PATH, SCOPES)

    print('Starting credentials flow...')
    credentials = tools.run_flow(flow, NullStorage())

    # Save the credentials in the same format as the Cloud SDK's authorized
    # user file.
    data = {
        'type': 'authorized_user',
        'client_id': flow.client_id,
        'client_secret': flow.client_secret,
        'refresh_token': credentials.refresh_token
    }

    with open(AUTHORIZED_USER_PATH, 'w') as fh:
        json.dump(data, fh, indent=4)

    print('Created {}.'.format(AUTHORIZED_USER_PATH))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号