Search code examples
google-cloud-platformgoogle-oauthaccess-tokenbotogsutil

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


I'm using a user account to access Google Play Console and get several monthly reporting. So, I developed a web app to get automatically this reporting (csv files) hosted in a Google Cloud Storage bucket (gs://uri). For that, a .boto file was created using "gsutil config" command where I obtained inside a refresh token oauth2 through the user account:

[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 = [*************]

This works fine, but (always a but...) I don't know how I can revoke/invalidate this refresh token. I mean, I can generate again a new refresh token with the "gsutil config" command but this action is not revoking/invalidating the previous token. Maybe someone on this planet could help me with this ;)

Many thanks in advance.

R.


Solution

  • You can send a request to the URL https://oauth2.googleapis.com/revoke?token={token}.

    This is mentioned in Google's documentation on how to use OAuth2 tokens in web services:

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