How Do I Logout Of Chrome

Posted on

I'm using chrome.identity to log into a 3rd party oauth provider in an chrome extension. It works fine for logging in- when I use launchWebAuthFlow I am presented with the third party login screen and redirected back to my application after the signin flow.

If you’re a heavy internet traveler, signing into Chrome is one of the most convenient features available on an internet-capable device. Just by entering your Gmail login and password into your. Click on that and look for setting in the menu that comes up. Click on settings then it will open a tab with a list of settings. Click disconnect account or something like that. It will then remove the account but keep all the stored settings on the computer so don't worry about your bookmarks and such.

However, I can't find a way to enable log out functionality in my extension. There doesn't seem to be a function to clear the cached logged in identity. The next time that launchWebAuthFlow is called, it will automatically log me in as the first user, and not prompt me to log in again.

Is there any way to clear the logged in state of the chrome.identity plugin?

infomofo
infomofoinfomofo
8552 gold badges8 silver badges20 bronze badges

6 Answers

I am not aware about the specific third party provider. But I faced the similar problem when using Google Oauth with chrome.identity.launchWebAuthFlow(). I could sign in the user, but not sign out using removeCachedAuthToken()

How Do I Logout Of Chrome

In this case, to logout the user, I used chrome.identity.launchWebAuthFlow() with Google's logout URL rather than it's oauth URL

This worked pretty well.

mlfanmlfan

I've found that calling these two in the sequence is working:

zengr
26.8k33 gold badges113 silver badges181 bronze badges
user5858user5858

You should add prompt=select_account to your auth URL. Your problem will be solved.

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

Lê VinhLê Vinh

How Do I Logout Of Chrome Facebook

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

Kyaw TunKyaw Tun
6,6541 gold badge24 silver badges52 bronze badges

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

How To Sign Out Of Chrome

user235273

I happened to hit the same problem recently, and I finally solved it by adding login_hint=<new_user> and prompt=consent in the login URL.

Walty YeungWalty Yeung

Not the answer you're looking for? Browse other questions tagged google-chrome-extensionoauth or ask your own question.