Writing A Simple Twitter Client Using the PHP Zend Framework's OAuth Library (Zend_Oauth)
By Pádraic Brady2009-10-20
Introduction
You can download all the necessary files (just be sure to edit them as described) or pull them from git from: http://github.com/padraic/Tweet-Lite/tree/master
What is OAuth?
If you're not aware of what OAuth is, the OAuth specification puts it this way:The OAuth protocol enables websites or applications (Consumers) to access Protected Resources from a web service (Service Provider) via an API, without requiring Users to disclose their Service Provider credentials to the Consumers. More generally, OAuth creates a freely-implementable and generic methodology for API authentication.
In other words, it's a means of allowing websites to access your data on other services via a service API, like Twitter's API or Google Gdata, without actually providing those websites with your username and password. Instead, OAuth allows you to authorise such websites to access your data so that they don't need your username or password - they just use an Access Token supplied by your service provider - and you can easily deauthorise them if desired. The benefit is immediately obvious - your username and password are not shared or handed out to potentially untrustworthy sites. The glut of services using Twitter are a prime example - until recently they all needed your Twitter username and password and honestly, how would you know they wouldn't misuse that? Because they said so? OAuth eliminates this problem.
The protocol works like this. The website (consumer) that wants to access your data from a service provider, contacts the provider using HTTP to retrieve a Unauthorised Request Token. The consumer will then redirect you, the user, back to your service provider so you can authorise the consumer's access. The redirect URL will contain the Unauthorised Request Token as a parameter. If you approve the access, you are redirected back to the original website with a verification code attached to the URL. The website now knows you approved its access, so it contacts the service provider, including both the newly approved Request Token (once again) and the verification code in the URL. The response to this should be a fully authorised Access Token (associated with the User) which the consumer can use in all future requests when accessing your data (until either it times out or you deauthorise the access). The Request Access token can be discarded now - in OAuth parlance you exchanged an unauthorised Request Token for an authorised Access Token.
Tutorial pages:
|
|
|||||||||
You might also want to check these out:
|
Leave a Comment on "Writing A Simple Twitter Client Using the PHP Zend Framework's OAuth Library (Zend_Oauth)"
You must be logged in to post a comment.
Link to This Tutorial Page!

