Search code examples
restgoogle-apigoogle-api-clientgoogle-authentication

User has shared access to his personal account. How to revoke shared access to Google account technically?


I can manage sharing access by user to his personal Google account via Google OAuth2. But this article does not contain information how to revoke the access.

I need remove authorization (a user should not have to remove 'account' from Connected Apps in Google). Google has special page for this purpose. I need use same functionality in my application but I've not found developers instruction for this.

So how could I implement UI API for client in my application to provide himself to revoke his OAuth2 token (token shared by him from Google earlier)? May be some rest API for this?


Solution

  • There are two ways for revoke scopes authorization.

    You can use the page you linked, about permissions, and manually remove the app.

    Or you can use the token revoke from Google. It's a GET request on this URL: https://accounts.google.com/o/oauth2/revoke?token={token}