Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reset google oauth 2.0 authorization?

Tags:

I'm using Google APIs Client Library for JavaScript (Beta) to authorize user google account on web application (for youtube manipulations). Everything works fine, but i have no idea how to "logout" user from my application, i.e. reset access tokens.

For example, following code checks user authorization and if not, shows popup window for user to log into account and permit web-application access to user data:

gapi.auth.authorize({client_id: CLIENT_ID, scope: SCOPES, immediate: false}, handleAuth);

But client library doesn't have methods to reset authorization.

There is workaround to redirect user to "accounts.google.com/logout", but this approach is not that i need: thus we logging user off from google account not only from my application, but also anywhere.

Google faq and client library description neither helpful.

like image 980
ZavtraMen Avatar asked Mar 26 '13 19:03

ZavtraMen


People also ask

How do I refresh Google OAuth token?

Because OAuth2 access expires after a limited time, an OAuth2 refresh token is used to automatically renew OAuth2 access. Click the tab for the programming language you're using, and follow the instructions to generate an OAuth2 refresh token and set up the configuration file for your client.

How do I reset my Google token?

Click TOOLS & SETTINGS (wrench icon) on the top right corner of the screen. Under SETUP, select API Center. Under API Access, expand the Developer token section. Click Reset token.

How do I revoke Google OAuth?

Go to the Security section of your Google Account. Under “Third-party apps with account access,” select Manage third-party access. Select the app or service you want to remove. Select Remove Access.

How do I revoke a Google OAuth refresh token?

that a fresh token can be revoked by sending a request containing either a refresh token (which you don't have) but also an access token. The token can be an access token or a refresh token. If the token is an access token and it has a corresponding refresh token, the refersh token will also be revoked.


1 Answers

Try revoking an access token, that should revoke the actual grant so auto-approvals will stop working. I assume this will solve your issue.

https://developers.google.com/accounts/docs/OAuth2WebServer#tokenrevoke

like image 146
mariuss Avatar answered Oct 14 '22 16:10

mariuss