oauth-io / oauth-phonegap

OAuth.io plugin for Apache Cordova/PhoneGap
195 stars 69 forks source link

Unable to change user #22

Closed Aldlevine closed 10 years ago

Aldlevine commented 10 years ago

(tested with facebook & google on iOS)

Once a user successfully logs in the first time, there's no way to switch to another account. Typically you'd expect to be able to go to the provider's site and change users there, then the affect would carry through but it doesn't in this case, as it seems the system browser / phonegap / child window are all isolated. Is there any way we can clear the cache on the child window? I'd like to do this on my applications logout, so the user will be able to switch accounts.

Thanks!!

william26 commented 10 years ago

Hi, this plugin might be what you're looking for: https://github.com/bez4pieci/Phonegap-Cookies-Plugin. Basically, it allows you to clear the cookies of the webview, and thus deleting the Facebook session.

Once installed, you can execute the following code from a logout button:

window.cookies.clear(function() {
    console.log('Cookies cleared!');
});

Then, when trying to login to Facebook through the OAuth.io SDK, you should see the login form in the popup again.

Hope that helps :)

Aldlevine commented 10 years ago

This is perfect! Thank you! I'd still love it if we could attach the cookies in phonegap to the system cookies to get a more "normal" flow, but this definitely makes it usable.

Thanks again!