4

I have been successful at Login in a user (asking for their approval and then letting them do some other protected stuff) and now I want to clear their login or in other words, Log them out when they click a button.

Is there a path that I could load a webview? I know other sites have something like https://somewebsite.com/logout which logs people out.

Please help me on this. Thanks in advance!

Eenvincible
  • 5,641
  • 2
  • 27
  • 46

2 Answers2

5

I figured out a way to clear everything. I hope someone else finds it useful!

public void clearCookies(){
    CookieSyncManager.createInstance(GooglePlusActivity.this);
    CookieManager cookieManager = CookieManager.getInstance();
    cookieManager.removeAllCookie();
}
Eenvincible
  • 5,641
  • 2
  • 27
  • 46
  • Doesn't this - cookieManager.removeAllCookie(); remove all cookies, not just the google ones? – dozer Jul 24 '17 at 11:49
1

Follow these Android signout instructions on the Google+ developer site to sign out the user and let them switch accounts or be logged out.

class
  • 8,621
  • 29
  • 30