0
votes

I am working on twitter API, and when i click on authorize button, API redirects me on twitter login page, after entering the twitter id and password, it redirects me on my callback page, but i want to logout the twitter account which i recently logged in while authorizing. can anyone help me that how to destroy the twitter session with php or help of twitter API.

I found a url to logout the twitter account to hit that url, but this is not my solution, because i don't wants to redirect the user to that url to logout, please help that how to logout twitter account with API or another way.

This is the url to logout the twitter session:

https://twitter.com/oauth/authenticate?oauth_token=XXXXXXXXXXXXXXXXXXXXX&force_login=true

Thanks.

2

2 Answers

0
votes

You can let the client's browser make a call to https://twitter.com/logout But apparently it requires a button click.

On https://dev.twitter.com/overview/api/twitter-libraries#php You can see a list of libraries for PHP, why don't you use them or just a piece of their code to accomplish the same effect the intended way?

example: $logout = $connection->get("oauth/authenticate", array("force_login" => "true"));

0
votes

I use unset($_SESSION['access_token']);