How can I exit the hrome.identity oauth provider

I use chrome.identity to log in to a third-party oauth provider in the chrome extension. It works great for login when I use launchWebAuthFlow . I am presented with a third-party login screen and redirected back to my application after the signin stream.

However, I cannot find a way to enable the logout function in my extension. There seems to be no function to clear the cached registered id. The next time launchWebAuthFlow is called, it will automatically log in as the first user and will not prompt me to log in again.

Is there a way to clear the registered state of the chrome.identity plugin?

+7
google-chrome-extension oauth
source share
5 answers

I do not know about a specific third-party provider. But I ran into a similar problem when using Google Oauth with chrome.identity.launchWebAuthFlow (). I could log in to the user, but not log out using removeCachedAuthToken ()

In this case, to log out, I used chrome.identity.launchWebAuthFlow () with the Google logout URL, not the URL

chrome.identity.launchWebAuthFlow( { 'url': 'https://accounts.google.com/logout' }, function(tokenUrl) { responseCallback(); } ); 

It worked very well.

+12
source share

You must add prompt=select_account to your url. Your problem will be resolved.

https://accounts.google.com/o/oauth2/auth?client_id= {clientId} & response_type = token & scope = {scopes} & redirect_uri = {redirectURL} & prompt = select_account

+3
source share

For me, https://accounts.google.com/logout does not work. But https://accounts.google.com/o/oauth2/revoke?token=TOKEN works well using a simple window.fetch(url) and not with hrome.identity.launchWebAuthFlow .

+1
source share

You can clear the cache identifier using the chrome.identity.removeCachedAuthToken(object details, function callback) method.
https://developer.chrome.com/apps/identity#method-removeCachedAuthToken

0
source share

Recently, I ran into the same problem, and I finally solved it by adding login_hint=<new_user> and prompt=consent to the login url.

0
source share

All Articles