Twitter oAuth login cancel?
I use Twitter login in an application. If user login, it works fine. I need to handle, when the user click cancel button in the twitter oauth login screen instead of lo开发者_StackOverflowgin. Is there any callback mechanism when the user click cancel button?
For a web application, if you redirect the user to Twitter for authorization and the user clicks on Deny, he/she has the option to go back to your application or not.
If the user didn't log in with their Twitter account, or closed the tab or went to a different URL. You won't really know, unless you keep track of users and check if he/she was gone longer than a specified time.
In this case, if the user clicks on the uBlogThis! link, the he/she will be redirected back to the application via the callbackURL you specified when getting the request token and! an HTTP GET variable denied
is included:
http://domain.com/twitterapp/callback.php?denied=8L74Y149FtnZi1M3IDstring
So then, you got to look out for $_GET['denied']
if your are using PHP for example.
If instead you open a popup window to show the user the Twitter authorization page via javascript, then you can check if the popup was closed without your callback URL being initiated. You can also add a timer to judge if the user went another way.
精彩评论