PHP Classes

PHP OAuth Library: Authorize and access APIs using OAuth

Recommend this page to a friend!
  Info   Example   Screenshots   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-03-19 (6 months ago) RSS 2.0 feedStarStarStarStar 72%Total: 26,721 This week: 6All time: 19 This week: 9Up
Version License PHP version Categories
oauth-api 1.0.137BSD License5.2PHP 5, User Management, Web services
Description 

Author

This class can authorize the access of users to an API using the OAuth protocol.

It abstracts OAuth1 (1.0 and 1.0a) and OAuth2 in the same class, so you can use the same code to authorize the access on behalf of the current user any API that supports any version of the OAuth protocol.

It works on Linux, Windows and any other platform without the PECL PHP OAuth extension.

The access tokens are stored by default in session variables, but there are sub-classes specialized in storing the tokens in database tables, files or cookies.

It provides built-in support to several popular OAuth servers, so you do not have to configure the class manually with all OAuth server specific details.

Currently it provides built-in support for many OAuth servers. Every other OAuth server is supported setting end point URLs and other parameters using specific class variables. Additional servers may be supported without changing the main class by configuring a separate JSON configuration file.

The class can also send requests to API using the previously obtained OAuth access token.

It also supports 2 legged API access, so it can send signed API requests that do not require user authorization.

For mobile or other applications that the user cannot be redirected back to the client application site, this class supports pin based authorization either using OAuth 1.0a or OAuth 2.0.

It can as well obtain access tokens for specific users given their user name and password or using client credentials. It supports OAuth 2.0 authorization flows authorization_code, password and client_credentials.

For servers that support offline access like Google and Box.net, the class can also verify if the access token expired and refresh the token value before sending an API call, without requiring the user presence.

For servers that support re-authentication like Facebook, the class may also force the user to enter this application password on the authorization page.

For servers that support revoking access tokens, the class supports this functionality to invalidate a previously retrieved token.

For OpenID Connect servers based on OAuth2, the class decoded and returns the id_token JSON Web Token (JWT), so applications can use the user details such as name and email returned in the id_token response.

Here is the list of OAuth servers that have built-in support and tutorial example scripts:

- 37Signals
- Amazon
- AOL
- Bitbucket
- Bitly
- Box
- Buffer
- CharterSpectrum
- CharterSpectrumQA (CharterSpectrum Quality Assurance)
- Copy
- Dailymotion
- Discogs
- Disqus
- Dropbox (Dropbox with OAuth 1.0)
- Dropbox2 (Dropbox with OAuth 2.0)
- Etsy
- Eventful
- Facebook
- Fitbit
- Flickr
- Foursquare
- Garmin
- github
- Google
- Google1 (Google with OAuth 1.0)
- iHealth
- iHealthSandbox
- imgur
- Infusionsoft
- Instagram
- Intuit
- Jawbone
- LinkedIn
- LinkedIn2 (LinkedIn with OAuth 2.0)
- mail.ru
- MailChimp
- Mavenlink
- Meetup
- Microsoft
- Misfit
- oDesk
- Odnoklassniki
- Paypal
- PaypalApplication
- Pinterest
- Pipedrive
- Polar
- Quire
- Rdio
- Reddit
- RunKeeper
- Salesforce
- Scoop.it
- StockTwits
- SurveyMonkey
- TeamViewer
- Tumblr
- Twitter
- Vimeo
- VK
- Withings
- Wordpress
- Xero
- XING
- Yahoo
- Yahoo2
- Yammer
- Yandex

Picture of Manuel Lemos
  Performance   Level  
Name: Manuel Lemos is available for providing paid consulting. Contact Manuel Lemos .
Classes: 45 packages by
Country: Portugal Portugal
Age: 55
All time rank: 1
Week rank: 5 Down1 in Portugal Portugal Equal

Recommendations

I need a PHP class for LinkedIn data scraping
Crawl and scrape data from LinkedIn

PHP OAuth API for Etsy
Library to handle OAuth 1.0 API

What is the best PHP payment gateway integration class?
Make payments through paytm or phonepe

Grab email, contact number from anonymous Web site visitor
Anonymous visitor identification using PHP

What is the best PHP skype api send message class?
PHP wrapper class for sending messages through PHP

login with linked library
i need linkedin libaray for login

Collect data to save in mySQL database
Use API to request posts, then process results and save to mySQL

Linkedin login
I need to create an app with login via linkedin

Google Docs using PHP
Interact with Google Docs

Oauth gsuite integration
Not allowing gsuite for general user

Retrieve Twitter user profile info
Integrate Twitter in my application

What is the best PHP facebook login class?
Facebook login to my website

PHP Class for Social login
Login using credentials from a social site such as Facebook

What is the best PHP facebook login class?
Would like some example of usage Facebook login

What is the best PHP youtube api class?
Get subscribers

What is the best PHP hotelbeds api class?
Hotelbeds API class

What is the best PHP php7 oauth http client class?
oAuth class which requires http client in PHP 7

What is the best PHP zurmo api class?
Working example of using the API to add a task

Integrate wit ai API
PHP class to integrate wit ai API

Fitbit Subscription API
Subscribing to Fitbit events and verify subscriber

How to login with Facebook?
Facebook login using OAuth 2.0

What is the best PHP flickr uploading class?
PHP uploader class for Flickr

What is the best PHP oauth class?
oAuth 2

Get latest Facebook posts on timeline
I need to get the last 5 facebook posts

Facebook auto publish without Facebook app
Automatically post in Facebook Simulating Human

What is the best PHP twitter auto post class?
want to auto post status from my site

Google Drive file management
Handle files using Google Drive API

Import Google contacts
Social login works but not import contacts

Developing an API with using Google and Facebook API
Create an own API works together with other social network APIs

Meetup OAuth connection code using PHP
I am getting an error trying to get property of non-object

Google custom search engine using the API
Google Custom Search engine using the API in PHP

Example

<?php
/*
 * login_with_facebook.php
 *
 * @(#) $Id: login_with_facebook.php,v 1.7 2018/08/16 07:09:40 mlemos Exp $
 *
 */

    /*
     * Get the http.php file from http://www.phpclasses.org/httpclient
     */
   
require('http.php');
    require(
'oauth_client.php');

   
$client = new oauth_client_class;
   
$client->debug = false;
   
$client->debug_http = true;
   
$client->server = 'Facebook';

   
// set the reauthenticate access only if you need to force the user to
    // authenticate again even after the user has authorized the application
    // before.
   
$client->reauthenticate = false;

   
$client->redirect_uri = 'https://'.$_SERVER['HTTP_HOST'].
       
dirname(strtok($_SERVER['REQUEST_URI'],'?')).'/login_with_facebook.php';

   
$client->client_id = ''; $application_line = __LINE__;
   
$client->client_secret = '';

    if(
strlen($client->client_id) == 0
   
|| strlen($client->client_secret) == 0)
        die(
'Please go to Facebook Apps page https://developers.facebook.com/apps , '.
           
'create an application, and in the line '.$application_line.
           
' set the client_id to App ID/API Key and client_secret with App Secret');

   
/* API permissions
     */
   
$client->scope = 'email,publish_actions,user_friends';
    if((
$success = $client->Initialize()))
    {
        if((
$success = $client->Process()))
        {
            if(
strlen($client->access_token))
            {
               
$success = $client->CallAPI(
                   
'https://graph.facebook.com/v2.3/me?fields=id,first_name,gender,last_name,link,locale,name,timezone,updated_time,verified,email',
                   
'GET', array(), array('FailOnAccessError'=>true), $user);
/*
                if($success)
                {
                    // Get Friends that use the same application

                    $success = $client->CallAPI(
                        'https://graph.facebook.com/v2.3/me/friends',
                        'GET', array(), array('FailOnAccessError'=>true), $friends);
                }
*/
               
if($success)
                {
                   
// Requires publish_actions permissions and your application needs to be submitted for review
                   
$values = array(
                       
// You can no longer pre-fill the user message
                       
'message'=>'',
                       
'link'=>'http://www.phpclasses.org/package/7700-PHP-Authorize-and-access-APIs-using-OAuth.html',
                       
// The name of the post can be retrieved from the page title
                        //'name' => 'This is the title',
                        // the description of the post can be retrieved from the page meta description
                       
'description'=>'This post was submitted using this PHP OAuth API client class.',
                       
'picture' => 'http://files.phpclasses.org/files/blog/package/7700/file/PHP%2BOAuth.png'
                   
);
                   
$success = $client->CallAPI(
                       
'https://graph.facebook.com/v2.3/me/feed',
                       
'POST', $values, array('FailOnAccessError'=>true), $post);
                }
/*
                if($success)
                {
                    // Post photos in your time line

                    $success = $client->CallAPI(
                        "https://graph.facebook.com/me/photos",
                        'POST', array(
                            'message'=>'This is a test to post photos in Facebook time line using this the PHP OAuth API class: http://www.phpclasses.org/oauth-api',
                            'source'=>'picture.jpg'
                        ),
                        array(
                            'FailOnAccessError'=>true,
                            'Files'=>array(
                                'source'=>array(
                        )
                    )
                ), $upload);
                }
*/
           
}
        }
       
$success = $client->Finalize($success);
    }
    if(
$client->exit)
        exit;
    if(
$success)
    {
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Facebook OAuth client results</title>
</head>
<body>
<?php
       
echo '<h1>', HtmlSpecialChars($user->name),
           
' you have logged in successfully with Facebook!</h1>';
        echo
'<pre>', HtmlSpecialChars(print_r($user, 1)), '</pre>';
        echo
'<pre>', HtmlSpecialChars(print_r($post, 1)), '</pre>';
?>
</body>
</html>
<?php
   
}
    else
    {
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>OAuth client error</title>
</head>
<body>
<h1>OAuth client error</h1>
<pre>Error: <?php echo HtmlSpecialChars($client->error); ?></pre>
</body>
</html>
<?php
   
}

?>


Details

PHP OAuth Library to Access Any OAuth API

The OAuth protocol is not hard to understand but it requires learning about many details and the many differences of operation with different OAuth servers.

OAuth PHP: Solutions

PHP has an extension for using OAuth but it practically requires that you learn all the specification documents for all aspects of the OAuth protocol.

Therefore it is better to use a client class like this encapsulate all steps so you do not have to learn so much about the OAuth protocol in all its versions.

PHP OAuth1 Client

This PHP class can work with OAuth 1.0 and 1.0a. Despite the class supports servers that work with OAuth 1.0, it is not a secure solution. So most servers that you see and support OAuth 1.0, it is actually OAuth 1.0a which is secure.

PHP OAuth2 Example

OAuth 2.0 is not a better version of OAuth 1.0a as if it was an upgrade. You may still see many servers that work securely using OAuth 1.0a.

Nowadays most servers use OAuth 2.0 because it is a protocol version that support more extensions.

The PHP OAuth class either OAuth 1.0, OAuth 1.0a and OAuth 2.0 . For the developer that uses this class, it does not make much difference because the function calls to use are the same.

The main internal difference is that OAuth 1.0a servers return both an access token value and an access token secret.

PHP OAuth Tutorial

Several articles have been written to tell not only how to use this package but also to tell about how the different versions of the OAuth protocol work.

You can read all the available tutorial articles in the package blog.

The main tutorial article is entitled PHP OAuth Tutorial on How to Use a Pure PHP OAuth Class with an Example Without using the PECL module Implementation.

OAuth Server PHP Configuration: Setting the PHP OAuth Server Variable to Access Any API

This PHP OAuth class can work with any server using OAuth1 or OAuth2. Just change the server variable to the name supported API.

The class provides built-in support for a few common APIs but any new API can be supported by adding a new entry to the oauth_configuration.json file.

This configuration file can be used to presets option values for class variables with the following names. Check the class documentation to learn the meaning of each of these option variables:

oauth_version
dialog_url
reauthenticate_dialog_url
pin_dialog_url
access_token_url
request_token_url
append_state_to_redirect_uri
authorization_header
url_parameters
token_request_method
signature_method
access_token_authentication
access_token_parameter
default_access_token_type
store_access_token_response
refresh_token_authentication
grant_type
access_token_content_type

Facebook OAuth2 PHP OAuth Example

Here is a simple example of getting the authorization token and making an API call to Facebook Graph API.

Check the complete Facebook OAuth2 PHP OAuth example here.

// Include the necessary class files directly or
// vendor/autoload.php if you used composer to install the package.
require('http.php');
require('oauth_client.php');

$client = new oauth_client_class;
$client->server = 'Facebook';

$client->client_id = 'your application id here';
$client->client_secret = 'your application secret here';

$client->scope = 'email';

if(($success = $client->Initialize()))
{
    if(($success = $client->Process()))
    {
        if(strlen($client->access_token))
        {
            $success = $client->CallAPI(
                'https://graph.facebook.com/v2.3/me?'.
                'fields=id,first_name,last_name,verified,email',
                'GET', array(), array('FailOnAccessError'=>true), $user);
        }
        $success = $client->Finalize($success);
    }
    if($client->exit)
        exit;
}     
if($success)
{
    echo '<h1>', HtmlSpecialChars($user->name), 
        ' you have logged in successfully with Facebook!</h1>';
}
else
{
    echo 'Error: ', HtmlSpecialChars($client->error);
}

Vimeo API PHP OAuth Example

Here is a simple example of getting the authorization token and making an API call to Vimeo API.

Check the complete Vimeo API PHP example here.

// Include the necessary class files directly or
// vendor/autoload.php if you used composer to install the package.
require('http.php');
require('oauth_client.php');

$client = new oauth_client_class;
$client->server = 'Vimeo';

$client->client_id = 'your application id here';
$client->client_secret = 'your application secret here';

if(($success = $client->Initialize()))
{
   if(($success = $client->Process()))
   {
      if(strlen($client->access_token))
      {
         $success = $client->CallAPI(
            'https://api.vimeo.com/me/?format=json', 
            'GET', array(), array('FailOnAccessError'=>true), $user);
      }
   }
   $success = $client->Finalize($success);
}
if($client->exit)
   exit;
if($success)
{
   echo '<h1>', HtmlSpecialChars($user->name), 
      ' you have logged in successfully with Vimeo!</h1>';
   echo '<pre>', HtmlSpecialChars(print_r($user, 1)), '</pre>';
}
else
{
  echo 'Error: ', HtmlSpecialChars($client->error);
}

Google Contacts API PHP Example

This example retrieves the Google user contacts using the People API.

Check the complete Google Contacts API PHP example here.

// Include the necessary class files directly or
// vendor/autoload.php if you used composer to install the package.
require('http.php');
require('oauth_client.php');

$client = new oauth_client_class;
$client->server = 'Google';

$client->client_id = 'your application id here';
$client->client_secret = 'your application secret here';

$client->scope = 'https://www.googleapis.com/auth/contacts.readonly';
if(($success = $client->Initialize()))
{
    if(($success = $client->Process()))
    {
        if(strlen($client->authorization_error))
        {
            $client->error = $client->authorization_error;
            $success = false;
        }
        elseif(strlen($client->access_token))
        {
            $success = $client->CallAPI(
                'https://people.googleapis.com/v1/people/me/connections'.
                '?fields=connections(emailAddresses%2Cnames)',
                'GET', array(), array('FailOnAccessError'=>true), $contacts);
        }
    }
    $success = $client->Finalize($success);
}
if($client->exit)
    exit;
if($success)
{
        echo '<pre>';
        foreach($contacts->connections as $contact)
        {
            echo htmlspecialchars($contact->names[0]->displayName), "\n";
        }
        echo '</pre>';
}
else
{
  echo 'Error: ', HtmlSpecialChars($client->error);
}

Pinterest API PHP OAuth Example

This example retrieves the Pinterest user details using the Pinterst API.

Check the complete Pinterest API PHP example here.

require('http.php');
require('oauth_client.php');

$client = new oauth_client_class;
$client->server = 'Pinterest';

$client->client_id = 'your application id here';
$client->client_secret = 'your application secret here';

$client->scope = 'read_public';
if(($success = $client->Initialize()))
{
    if(($success = $client->Process()))
    {
        if(strlen($client->authorization_error))
        {
            $client->error = $client->authorization_error;
            $success = false;
        }
        elseif(strlen($client->access_token))
        {
            $success = $client->CallAPI(
                'https://api.pinterest.com/v1/me/',
                'GET', array(), array('FailOnAccessError'=>true), $user);
        }
    }
    $success = $client->Finalize($success);
}
if($client->exit)
    exit;
if($success)
{
    echo '<h1>', HtmlSpecialChars($user->data->first_name),
        ' you have logged in successfully with Google!</h1>';
    echo '<pre>', HtmlSpecialChars(print_r($user, 1)), '</pre>';
}
else
{
  echo 'Error: ', HtmlSpecialChars($client->error);
}

Screenshots (2)  
  • Google-Sheets-API-Access-PHP-Example.png
  • php-oauth-api.png
  Files folder image Files (97)  
File Role Description
Plain text file oauth_client.php Class OAuth client class
Accessible without login HTML file oauth_client_class.html Doc. Documentation of the OAuth client class
Accessible without login Plain text file access_google_sheets_spreadsheet.php Example Google Sheets API access example script
Accessible without login Plain text file call_quire.php Example Call Quire API example script
Accessible without login Plain text file classmaps.php Aux. Class maps definition
Plain text file cookie_oauth_client.php Class OAuth client sub-class sor storing and retrieving tokens in encrypted
Plain text file database_oauth_client.php Class OAuth client sub-class for storing and retrieving tokens in databases
Accessible without login Plain text file enter_pin.php Aux. Helper script to let the user enter the authorization pin
Accessible without login Plain text file file_get_google_account.php Example Example script to demonstrate how to get a Google user profile with a OAuth token without the user presence
Accessible without login Plain text file file_login_with_google.php Example Example of logging in with Google using OAuth and storing the access token in a file
Plain text file file_oauth_client.php Class OAuth client sub-class for storing and retrieving tokens in files
Accessible without login Plain text file google_contacts_api_php_example.php Example Example to get the user contacts using the Google People API
Accessible without login Plain text file google_natural_lan...timent_analysis.php Example Google natural language artificial intelligence API call example script
Accessible without login Plain text file LICENSE Lic. License of the class
Accessible without login Plain text file list_files_in_google_drive.php Example Google Drive API list files example script
Accessible without login Plain text file login_check_with_facebook.php Example Example of checking if the user has authorized Facebook API access without redirecting to the authorization page
Accessible without login Plain text file login_with_37signals.php Example Example of logging in with 37Signals using OAuth
Accessible without login Plain text file login_with_amazon.php Example Example of logging in with Amazon using OAuth
Accessible without login Plain text file login_with_aol.php Example Example of logging in with AOL using OAuth
Accessible without login Plain text file login_with_bitbucket.php Example Example of logging in with Bitbucket using OAuth
Accessible without login Plain text file login_with_bitly.php Example Example of logging in Bitly using OAuth
Accessible without login Plain text file login_with_box.php Example Example of logging in with Box.net using OAuth
Accessible without login Plain text file login_with_buffer.php Example Example of logging in with Buffer using OAuth
Accessible without login Plain text file login_with_charter_spectrum.php Example Example of logging in with Facebook using CharterSpectrum
Accessible without login Plain text file login_with_copy.php Example Example of logging in with Copy using OAuth
Accessible without login Plain text file login_with_dailymotion.php Example Example of logging in with Dailymotion using OAuth
Accessible without login Plain text file login_with_discogs.php Example Example of logging in with Discogs using OAuth
Accessible without login Plain text file login_with_disqus.php Example Example of logging in with Disqus using OAuth
Accessible without login Plain text file login_with_dropbox.php Example Example of logging in with Dropbox using OAuth
Accessible without login Plain text file login_with_etsy.php Example Example of logging in with Etsy using OAuth
Accessible without login Plain text file login_with_eventful.php Example Example of logging in with Eventful using OAuth
Accessible without login Plain text file login_with_facebook.php Example Example of logging in with Facebook using OAuth
Accessible without login Plain text file login_with_fitbit.php Example Example of logging in with Fitbit using OAuth
Accessible without login Plain text file login_with_fitbit2.php Example Example of logging in with Fitbit using OAuth 2.0
Accessible without login Plain text file login_with_fitnesssyncer.php Example Example logging in with FitnessSyncer using OAuth
Accessible without login Plain text file login_with_flickr.php Example Example of logging in with Flickr using OAuth
Accessible without login Plain text file login_with_foursquare.php Example Example of logging in with Foursquare using OAuth
Accessible without login Plain text file login_with_garmin.php Example Example of logging in with Garmin using OAuth
Accessible without login Plain text file login_with_github.php Example Example of logging in with github using OAuth
Accessible without login Plain text file login_with_google.php Example Example of logging in with Google using OAuth
Accessible without login Plain text file login_with_ihealth.php Example Example of logging in with iHealth using OAuth
Accessible without login Plain text file login_with_imgur.php Example Example of logging in with imgur using OAuth
Accessible without login Plain text file login_with_infusionsoft.php Example Example of logging in with Infusionsoft using OAuth
Accessible without login Plain text file login_with_instagram.php Example Example of logging in with Instagram using OAuth
Accessible without login Plain text file login_with_intuit.php Example Example of loggin in with Intuit (Quickbooks) using OAuth
Accessible without login Plain text file login_with_jawbone.php Example Example of logging in Jawbone using OAuth
Accessible without login Plain text file login_with_linkedin.php Example Example logging in with LinkedIn using OAuth
Accessible without login Plain text file login_with_linkedin2.php Example Example logging in with LinkedIn using OAuth 2.0
Accessible without login Plain text file login_with_livecoding.php Example Example of logging in with Livecoding.tv
Accessible without login Plain text file login_with_mail.ru.php Example Example of logging in with mail.ru using OAuth
Accessible without login Plain text file login_with_mailchimp.php Example Example logging in with MailChimp
Accessible without login Plain text file login_with_mavenlink.php Example Example of logging in Mavenlink using OAuth
Accessible without login Plain text file login_with_meetup.php Example Example of logging in with Meetup using OAuth
Accessible without login Plain text file login_with_microsoft.php Example Example of logging in with Microsoft Hotmail or Windows Live account
Accessible without login Plain text file login_with_microsoft_openid_connect.php Example Example of logging in with Microsoft OpenID Connect
Accessible without login Plain text file login_with_misfit.php Example Example of logging in with Misfit using OAuth
Accessible without login Plain text file login_with_odesk.php Example Example of logging in oDesk using OAuth
Accessible without login Plain text file login_with_odnoklassniki.php Example Example of logging in with Odnoklassniki using OAuth
Accessible without login Plain text file login_with_paypal.php Example Example of logging in with Paypal using OAuth
Accessible without login Plain text file login_with_pinterest.php Example Example of logging in with Pinterest using OAuth
Accessible without login Plain text file login_with_pipedrive.php Example Example of logging in with Pipedrive using OAuth
Accessible without login Plain text file login_with_polar.php Example Example of logging in with Polar using OAuth
Accessible without login Plain text file login_with_quire.php Example Login with Quire example script
Accessible without login Plain text file login_with_rdio.php Example Example of logging in with Rdio using OAuth
Accessible without login Plain text file login_with_reddit.php Example Example of logging in with Reddit using OAuth
Accessible without login Plain text file login_with_rightsignature.php Example Example of logging in with RightSignature using OAuth
Accessible without login Plain text file login_with_runkeeper.php Example Example of logging in RunKeeper using OAuth
Accessible without login Plain text file login_with_salesforce.php Example Example of logging in with Salesforce using OAuth
Accessible without login Plain text file login_with_scoopit.php Example Example of logging in with Scoop.it using OAuth
Accessible without login Plain text file login_with_stocktwits.php Example Example of logging in with StockTwits using OAuth
Accessible without login Plain text file login_with_surveymonkey.php Example Example of logging in with SurveyMonkey using OAuth
Accessible without login Plain text file login_with_teamviewer.php Example Example of logging in with TeamViewer using OAuth
Accessible without login Plain text file login_with_tumblr.php Example Example of logging in with Tumblr using OAuth
Accessible without login Plain text file login_with_twitter.php Example Example of logging in with Twitter using OAuth
Accessible without login Plain text file login_with_twitter2.php Example Example of how to implement application-only access to Twitter API using OAuth 2 client_credentials grant_type
Accessible without login Plain text file login_with_uber.php Example Example of logging in with Uber using OAuth
Accessible without login Plain text file login_with_vimeo.php Example Example of logging in with Vimeo using OAuth
Accessible without login Plain text file login_with_vk.php Example Example of logging in with VK using OAuth
Accessible without login Plain text file login_with_withings.php Example Example of logging in with Withings using OAuth
Accessible without login Plain text file login_with_wordpress.php Example Example of logging in with Wordpress using OAuth
Accessible without login Plain text file login_with_xero.php Example Example of logging in with Xero using OAuth
Accessible without login Plain text file login_with_xing.php Example Example of logging in with XING using OAuth
Accessible without login Plain text file login_with_yahoo.php Example Example of logging in with Yahoo using OAuth
Accessible without login Plain text file login_with_yammer.php Example Example of logging in with Yammer using OAuth
Accessible without login Plain text file login_with_yandex.php Example Example of logging in with Yandex using OAuth
Accessible without login Plain text file logout_from_google.php Example Example of logging out from Google using OAuth
Accessible without login Plain text file mysqli_login_with_google.php Example Example of logging in with Google using OAuth and storing the access token in a MySQL database
Accessible without login Plain text file mysqli_login_with_twitter.php Example Example of logging in with Twitter using OAuth and storing the access token in a MySQL database
Plain text file mysqli_oauth_client.php Class OAuth client sub-class for storing and retrieving tokens in a MySQL database using the mysqli extension
Plain text file mysqli_offline_access_to_google.php Class Example of accessing the Google API offline using a OAuth token stored in a MySQL database
Accessible without login Plain text file mysqli_offline_access_to_twitter.php Example Example accessing the Twitter API offline using a OAuth token stored in a MySQL database
Accessible without login Plain text file oauth.sql Data MySQL queries to install the oauth_session table
Accessible without login Plain text file oauth_configuration.json Data External configuration of OAuth
Accessible without login Plain text file README.md Doc. Basic instructions about this PHP OAuth API client package
Accessible without login Plain text file test_oauth_client.php Example Example of using the OAuth client

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
Downloadoauth-api-2024-03-19.zip 211KB
Downloadoauth-api-2024-03-19.tar.gz 139KB
Install with ComposerInstall with Composer
Needed packages  
Class DownloadWhy it is needed Dependency
PHP HTTP protocol client Download .zip .tar.gz Send HTTP request to OAuth servers Required
 Version Control Reuses Unique User Downloads Download Rankings  
 96%3
Total:26,721
This week:6
All time:19
This week:9Up
User Ratings User Comments (32)
 All time
Utility:93%StarStarStarStarStar
Consistency:89%StarStarStarStarStar
Documentation:83%StarStarStarStarStar
Examples:85%StarStarStarStarStar
Tests:-
Videos:-
Overall:72%StarStarStarStar
Rank:163
 
Saludos Manuel, felicidades, una gran Clase.
4 years ago (victor victor)
80%StarStarStarStarStar
jkhbjkbk
5 years ago (Abhay Singh)
0%Star
Excellent library!
6 years ago (Michael V.)
80%StarStarStarStarStar
A document better explaining where to integrate existing dat...
7 years ago (Peter)
70%StarStarStarStar
A document better explaining where to integrate existing dat...
7 years ago (Peter)
70%StarStarStarStar
nice
7 years ago (muabshir)
80%StarStarStarStarStar
Many thanks for this class and the subsequent support which h...
7 years ago (Murray Russell)
75%StarStarStarStar
I love this package.
7 years ago (Johnny Mast)
77%StarStarStarStar
I love this package.
7 years ago (Johnny Mast)
77%StarStarStarStar
I was pleasantly surprised to see this library work flawlessl...
8 years ago (Husain Al-Bustan)
80%StarStarStarStarStar
Very nice application library, though I've yet to figure out ...
8 years ago (Greg Burns)
75%StarStarStarStar
Manuel was so helpful in terms of code and communication.
8 years ago (Tyler)
80%StarStarStarStarStar
Finally, a Microsoft Live authentication working :) Hybridaut...
8 years ago (chris lachance)
80%StarStarStarStarStar
I wish there was better documentation such as using Data for ...
9 years ago (Melissa Williams)
65%StarStarStarStar
Finally an abstract class to work with oauth (1 and 2).
9 years ago (rodrigo butta)
75%StarStarStarStar
Works perfect.
9 years ago (Kasper)
80%StarStarStarStarStar
where is http.
9 years ago (Konrad Tomaszewski)
40%StarStarStar
I had just stumbled upon this site, so had no particular trus...
9 years ago (sootsnoot)
77%StarStarStarStar
It has worked like a charm, thank you very much work make my ...
9 years ago (Antonio)
80%StarStarStarStarStar
Really great job.
9 years ago (Thennarasu)
80%StarStarStarStarStar
Excellent Service
10 years ago (Dilip)
80%StarStarStarStarStar
Complete package
10 years ago (jack chan)
75%StarStarStarStar
Super
10 years ago (Vallee Jean-Francois)
80%StarStarStarStarStar
sccv
10 years ago (kashif)
40%StarStarStar
Really good examples
11 years ago (Jan Jansen)
80%StarStarStarStarStar
Thanks.
11 years ago (John Erck)
80%StarStarStarStarStar
Excellent package, thank you very much.
11 years ago (Jake Weisz)
80%StarStarStarStarStar
Made changes to enable me to run the class on my shared host.
11 years ago (John Rambelle)
80%StarStarStarStarStar
Can you estimate how many updates / correction will follow? T...
11 years ago (Dietmar Bückart)
57%StarStarStar
Just perfect!
11 years ago (Marek Sieroci?ski)
80%StarStarStarStarStar
I find this package very usefull for some projects I am worki...
12 years ago (Frederik Yssing)
80%StarStarStarStarStar
I am very enthousiastic about this package.
12 years ago (Arno Buizer)
80%StarStarStarStarStar