OAuth Login System is one of the needed system in a website. There are many online services that have their own OAuth system. Popular Services have their own PHP OAuth library and documentation.
But, we’re gonna use a simpler and a common Library for all of those services. This common library (OAuth API) is created by PHPClasses.org founder Manuel Lemos.
His library can be used to authorize many API‘s including Facebook, Twitter, Google. Everything is made easy by Manuel. He is a hard working programmer. That’s why he has the # 1 rank on PHP Classes.
Demo
Download
Only some files are needed from the library to accomplish our tasks. You can see the all the Library files @ PHPClasses. OAuth API also need the HTTP Protocol Client class. Here are the files you need to download for OAuth API :
Features
- Implement the OAuth protocol to retrieve a token from a server to authorize the access to an API on behalf of the current user.
- Store authorization details (access token, refresh token etc..) according to users in a table using SQL.
- Offline Access to API‘s
- Perform calls to a Web services API using a token previously obtained using this class or a token provided some other way by the Web services provider.
Some Of The OAuth API’s
- Ubuntu
- Microsoft Live
- Tumblr
- Yahoo
and many more…..
Including
You only have to include oauth_client.php. **http.php **will be included by oauth_client.php :
<?php
require("oauth_client.php");
?>
Examples
As I mentioned in the demo part before, this has been implemented in Open. You can see the source code of them :
I will be publishing posts about implementing various API‘s using this library in the future.