【问题标题】:Revoke/Invalidate the oauth2 refresh token generated in a .boto file (gsutil config)撤销/使 .boto 文件(gsutil config)中生成的 oauth2 刷新令牌无效
【发布时间】:2021-07-24 04:20:07
【问题描述】:

我正在使用一个用户帐户访问 Google Play 管理中心并获取多个月度报告。 因此,我开发了一个网络应用程序来自动获取托管在 Google Cloud Storage 存储桶 (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 = [*************]

这很好用,但是(总是...)我不知道如何撤销/使此刷新令牌无效。我的意思是,我可以使用“gsutil config”命令再次生成新的刷新令牌,但此操作不会撤销/使之前的令牌无效。 也许这个星球上的某个人可以帮助我;)

非常感谢。

R.

【问题讨论】:

    标签: google-cloud-platform google-oauth access-token boto gsutil


    【解决方案1】:

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

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

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

    【讨论】:

    • 谢谢@mhouglum!使用 HTTP/Rest 方法效果很好: curl -d -X -POST --header "Content-type:application/x-www-form-urlencoded" oauth2.googleapis.com/revoke?token={token}
    猜你喜欢
    • 1970-01-01
    • 2015-12-13
    • 2017-10-03
    • 2021-09-24
    • 2021-07-30
    • 2017-11-09
    • 2019-04-12
    • 2020-07-31
    • 2020-05-02
    相关资源
    最近更新 更多