Skip to content

Instantly share code, notes, and snippets.

@HunnyJummani
Created March 6, 2020 07:17
Show Gist options
  • Save HunnyJummani/cb5c0ebf6065d5ceebe9938356d2c9f8 to your computer and use it in GitHub Desktop.
Save HunnyJummani/cb5c0ebf6065d5ceebe9938356d2c9f8 to your computer and use it in GitHub Desktop.
# client => Any Google API client
# refresh_token as token in params is mandatory.
uri = URI('https://accounts.google.com/o/oauth2/revoke')
params = { token: client.refresh_token }
uri.query = URI.encode_www_form(params)
response = Net::HTTP.get(uri)
# will get a {} if access is revoked and errors if any.
result = JSON.parse(response)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment