Mohammad Rababah
Mohammad Rababah

Reputation: 1726

Logout from twitter api android

I am trying to integrate my app to twitter and I do it

but my question is: How I can logout from twitter? can I remove RequestToken or OAuth of my app?

I tried to use:

but does not work

also does not work

please help me

thanks in advance

Upvotes: 4

Views: 1593

Answers (4)

sivaprakash
sivaprakash

Reputation: 538

Remove All Cookies

android.webkit.CookieManager.getInstance().removeAllCookie();

Remove Specific Cookies

CookieManager.getInstance().setCookie("twitter.com", "auth_token=''");

Upvotes: 0

natedogg265
natedogg265

Reputation: 239

Current method

TwitterCore.getInstance().getSessionManager().clearActiveSession();

Upvotes: 0

Dmytro Rostopira
Dmytro Rostopira

Reputation: 11175

@Rob answer is working, but this methods was removed in Twitter SDK v3.0.0

According to upgrading guide:

[Removed] TwitterCore#logOut() was removed use TwitterCore.getInstance().getSessionManager().clearActiveSession() instead.

Upvotes: 5

Rob
Rob

Reputation: 748

In android application, if you are using Fabric and you want to logout from Twitter, try this:

Twitter.getInstance();
Twitter.logOut();

Upvotes: 3

Related Questions