Reputation: 3
I Want to remove Auth token from Application Class,In My Twitter app How can I do this Please help me
Thank You
Upvotes: 0
Views: 1981
Reputation: 7578
TwitterApp mTwitter = new TwitterApp(MyProfile.this, Constants.TWITTER_CONSUMER_KEY,
Constants.TWITTER_SECRET_KEY);
mTwitter.resetAccessToken();
This much worked well for me, ussing the twitter4j. Just calling the resetAccessToken is equivalent to logout.
Upvotes: 0
Reputation: 1710
there is no need to remove auth token, u just need to post one query to twitter api as follow. it will delete all store cookies and tokens stored by twitter.
public void logoutToTwitter() {
// Create a new HttpClient and Post Header
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://api.twitter.com/1/account/end_session.format");
try {
// Execute HTTP Post Request
httpclient.execute(httppost);
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
} catch (IOException e) {
// TODO Auto-generated catch block
} }
just call the above method on your "twitter logout button"
enjoy the code.
Upvotes: 5