Zend Framework 101: Zend_Oauth
How OAuth Works
There are many guides and diagrams of how oAuth works available online, but to keep things simple, here's what you need to know for authenticating with Twitter:
- Web application requests an authentication token from Twitter
- Web application redirects user to Twitter
- User signs in to Twitter then authorizes your web application
- Twitter redirects user back to web application with authorization token
- Web application requests access token from Twitter
Assuming each of these steps completes correctly (that is, the user successfully authenticates and then allows your application access), you can then access the Twitter API with their account.
For more details of how this process works (specifically with Twitter), I recommended the following pages:
In the code we will implement in this article we have a protected page that users can only access once they've authenticated with Twitter. We will write their access token to a database table so we can use it again in future. Currently there is no expiration date on a Twitter access token.