2017 © Pedro Peláez
 

library oauth2

Authorize users in your application with multiple OAuth 2.0 providers

image

chrisnharvey/oauth2

Authorize users in your application with multiple OAuth 2.0 providers

  • Thursday, May 28, 2015
  • by chrisnharvey
  • Repository
  • 1 Watchers
  • 2 Stars
  • 37 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 1 Versions
  • 3 % Grown

The README.md

OAuth 2.0 Composer Package

Deprecated: Use league/oauth2-client., (*1)

Authorize users with your application using multiple OAuth 2 providers., (*2)

Supported Providers

  • Appnet
  • Facebook
  • Foursquare
  • GitHub
  • Google
  • Instagram
  • Mailchimp
  • Mailru
  • PayPal
  • Soundcloud
  • Vkontakte
  • Windows Live
  • Yandex
  • YouTube

Usage Example

In this example we will authenticate the user using Facebook., (*3)

$oauth = new \OAuth2\Provider\Facebook(array(
    'id' => 'CLIENT_ID',
    'secret' => 'CLIENT_SECRET',
    'redirect_url' => 'URL_TO_THIS_PAGE'
));

if ( ! $oauth->isAuthenticated()) {
    header("Location: {$oauth->getAuthenticationUrl()}");
    exit;
}

// Tokens
print_r($oauth->getUserTokens());

// User data
print_r($oauth->getUserInfo());

If all goes well you should see a dump of the users tokens and data., (*4)

Calling OAuth 2 APIs using Guzzle

You can also use this package to make calls to your respective APIs using Guzzle., (*5)

$client = new \OAuth2\Client('https://graph.facebook.com');
$client->setUserTokens($oauth->getUserTokens());

echo $client->get('me')->send();

This example should show your Facebook profile from the API along with the headers, (*6)

Contribute

  1. Check for open issues or open a new issue for a feature request or a bug
  2. Fork the repository on Github to start making your changes to the develop branch (or branch off of it)
  3. Write a test which shows that the bug was fixed or that the feature works as expected
  4. Send a pull request and bug me until I merge it

The Versions

28/05 2015

dev-master

9999999-dev

Authorize users in your application with multiple OAuth 2.0 providers

  Sources   Download

dbad-license

The Requires

 

The Development Requires

by Chris Harvey

authentication authorization oauth providers