Implementing OAuth System Using OAuth API Library In PHP


Read {count} times since 2020

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 founder Manuel Lemos.

His library can be used to authorize many API‘s including FacebookTwitterGoogle. Everything is made easy by Manuel. He is a hard working programmer. That’s why he has the # 1 rank on PHP Classes.


Login With Facebook

Login With Google


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 :

  1. oauth_client.php
  2. http.php


  1. Implement the OAuth protocol to retrieve a token from a server to authorize the access to an API on behalf of the current user.
  2. Store authorization details (access token, refresh token etc..) according to users in a table using SQL.
  3. Offline Access to API‘s
  4. 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

  1. Facebook
  2. Google
  3. Twitter
  4. LinkedIn
  5. Instagram
  6. Ubuntu
  7. Microsoft Live
  8. Tumblr
  9. Yahoo

and many more…..


You only have to include oauth_client.phphttp.php will be included by oauth_client.php :



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.

Show Comments