在 python 中为 google oauth2 手动更新 access_token

Manually update access_token for google oauth2 in python

我正在使用 google oauthlib 获取 access_token 并使用它来使用 requests 获取 gmail atom feed,因为 python 库不支持它.

当使用驱动器等受支持的服务时,令牌会自动刷新,我的情况如何?

假设您有刷新令牌,您可以使用它通过 HTTP POST

请求新的访问令牌
https://accounts.google.com/o/oauth2/token

client_id={ClientId}.apps.googleusercontent.com&client_secret={ClientSecret}&refresh_token=1/ffYmfI0sjR54Ft9oupubLzrJhD1hZS5tWQcyAvNECCA&grant_type=refresh_token

这个Link可能会有所帮助Google 3 legged oauth2 flow