Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I log out of a chrome.identity oauth provider

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.

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?

like image 802
infomofo Avatar asked Sep 28 '14 00:09

infomofo


1 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()

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

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

This worked pretty well.

like image 112
mlfan Avatar answered Oct 23 '22 07:10

mlfan