Revoke/Invalidate 在 .boto 文件中生成的 oauth2 刷新令牌(gsutil 配置)

Revoke/Invalidate the oauth2 refresh token generated in a .boto file (gsutil config)

我正在使用用户帐户访问 Google Play 管理中心并获取多个月度报告。 因此,我开发了一个网络应用程序来自动获取托管在 Google 云存储桶 (gs://uri) 中的此报告(csv 文件)。 为此,使用“gsutil config”命令创建了一个 .boto 文件,我通过用户帐户在其中获得了刷新令牌 oauth2:

[Credentials]

# Google OAuth2 credentials (for "gs://" URIs):
# The following OAuth2 account is authorized for scope(s):
#     https://www.googleapis.com/auth/cloud-platform
#     https://www.googleapis.com/auth/accounts.reauth
gs_oauth2_refresh_token = [*************]

这很好用,但是(总是但是...)我不知道如何 revoke/invalidate 这个刷新令牌。我的意思是,我可以使用“gsutil config”命令再次生成一个新的刷新令牌,但此操作不是 revoking/invalidating 先前的令牌。 也许这个星球上有人可以帮我解决这个问题 ;)

非常感谢。

R.

您可以向 URL https://oauth2.googleapis.com/revoke?token={token} 发送请求。

Google 关于如何在 Web 服务中使用 OAuth2 令牌的文档中提到了这一点:

https://developers.google.com/identity/protocols/oauth2/web-server#tokenrevoke