How to detect if a user has authorized or not authorized your application with account/verify_credentials


#1

Lately, I’ve been working on a Sign in with Twitter PHP script. What I want to do is I want my code to detect wether the user has already authorized my application or not. I’ve heard I can do something like this with account/verify_credentials, but how? For example in https://dev.twitter.com/discussions/1241 Taylor Singletary is stating that “Use account/verify_credentials before posting to determine if you still have the ability to make calls on that user’s behalf.” This is an example of what I want to accomplish:

if(user has registered with application) {
// If user HAS authorized application
} else {
// If user has NOT authorized application
}

How can I accomplish something like this? Any help would be highly appreciated.


#2

The easiest way is probably to do an authenticated call to http://api.twitter.com/1/account/verify_credentials.json and then store the result in a variable that you can in your if/else logic.

Your application will get a HTTP 200 OK response if authentication was successful, or a 401 if not.

See [node:14] for all the details.


#3

Any body help me, i want, people login to my application & automatic retweet my tweets
Pleass help me
Email me on HassanSwabi35@gmail.com

Advance thanks