开发者

How to log out from twitter

开发者 https://www.devze.com 2023-03-13 01:32 出处:网络
I have successfully created an app to login user and post the tweetusing OAuth support but I cannot figure a way to logout user or force login (using twitter

I have successfully created an app to login user and post the tweet using OAuth support but I cannot figure a way to logout user or force login (using twitter login). Any help i开发者_Go百科s highly appreciated.

thnks in advance


I believe this question has answers that will work for you. I'll post summaries here for convenience.

From Ryan McGeary:

The session with Twitter is defined by a cookie owned by Twitter -- something you do not have control over. You cannot log them out of Twitter on their behalf.

If you want someone to be able to use your "switch twitter account" functionality, you'll need to pass them off to the OAuth handshake again, but use the /oauth/authorize path instead of the /oauth/authenticate path. This will allow the user to switch their user credentials at Twitter during the handshake instead of just re-authenticating using their existing Twitter session.

From abraham:

You can use oauth/authenticate and add force_login=true as specified in http://dev.twitter.com/doc/get/oauth/authenticate*. This will prompt the user with a login form.

**updated reference to most recent documentation*

If any of answers above work for you, be sure to follow the link and upvote the originals.


What i do for logout is i wont save the security token from OAuth . Otherwise it lasts forever, I don't recall seeing a logout api.Wat i do is, will leave the token n get the new one at the time of login. There maybe some api for logout but im not sure about it.


If you use the twitter using OAuth support then the user is automatically logged in after first run. What can be done is to uninstall the whole application as the tokens are saved after first run of the application , so all information remains with the application.

0

精彩评论

暂无评论...
验证码 换一张
取 消