2017 © Pedro Peláez
 

library oauth2-client

OAuth 2.0 Client Library

image

datingvip/oauth2-client

OAuth 2.0 Client Library

  • Thursday, August 10, 2017
  • by kornrunner
  • Repository
  • 12 Watchers
  • 0 Stars
  • 1,090 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 515 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

OAuth 2.0 Client Library

This library makes it stupidly simple to integrate your application with OAuth 2.0 identity providers. It has built in support for:, (*1)

  • Facebook
  • Github
  • Google
  • Instagram
  • LinkedIn
  • Microsoft

Adding support for other providers is trivial., (*2)

The library requires PHP 5.3+ and is PSR-0 compatible., (*3)

Usage

$provider = new League\OAuth2\Client\Provider\<provider name>(array(
    'clientId'  =>  'XXXXXXXX',
    'clientSecret'  =>  'XXXXXXXX',
    'redirectUri'   =>  'http://your-registered-redirect-uri/'
));

if ( ! isset($_GET['code'])) {

    // If we don't have an authorization code then get one
    $provider->authorize();

} else {

    try {

        // Try to get an access token (using the authorization code grant)
        $t = $provider->getAccessToken('authorization_code', array('code' => $_GET['code']));

        try {

            // We got an access token, let's now get the user's details
            $userDetails = $provider->getUserDetails($t);

            foreach ($userDetails as $attribute => $value) {
                var_dump($attribute, $value) . PHP_EOL . PHP_EOL;
            }

        } catch (Exception $e) {

            // Failed to get user details

        }

    } catch (Exception $e) {

        // Failed to get access token

    }
}

List of built-in identity providers

Provider uid nickname name first_name last_name email location description imageUrl urls
Facebook string string string string string string string string string array (Facebook)
Github string string string null null string null null null array (Github, [personal])
Google string string string string string string null null string null
Instagram string string string null null null null string string null
LinkedIn string null string null null string string string string string
Microsoft string null string string string string null null string string

Notes: Providers which return URLs sometimes include additional URLs if the user has provided them. These have been wrapped in [], (*4)

The Versions

10/08 2017

dev-master

9999999-dev https://github.com/datingvip/oauth2-client

OAuth 2.0 Client Library

  Sources   Download

MIT

The Requires

 

The Development Requires

authentication authorization oauth sso oauth2 identity idp single sign on

10/08 2017

v0.8

0.8.0.0 https://github.com/datingvip/oauth2-client

OAuth 2.0 Client Library

  Sources   Download

MIT

The Requires

 

The Development Requires

authentication authorization oauth sso oauth2 identity idp single sign on

24/06 2016

v0.7

0.7.0.0 https://github.com/datingvip/oauth2-client

OAuth 2.0 Client Library

  Sources   Download

MIT

The Requires

 

The Development Requires

authentication authorization oauth sso oauth2 identity idp single sign on

23/06 2016

v0.6

0.6.0.0 https://github.com/datingvip/oauth2-client

OAuth 2.0 Client Library

  Sources   Download

MIT

The Requires

 

The Development Requires

authentication authorization oauth sso oauth2 identity idp single sign on

12/01 2016

v0.5

0.5.0.0 https://github.com/datingvip/oauth2-client

OAuth 2.0 Client Library

  Sources   Download

MIT

The Requires

 

The Development Requires

authentication authorization oauth sso oauth2 identity idp single sign on

22/10 2015

v0.4

0.4.0.0 https://github.com/datingvip/oauth2-client

OAuth 2.0 Client Library

  Sources   Download

MIT

The Requires

 

The Development Requires

authentication authorization oauth sso oauth2 identity idp single sign on

25/03 2013

0.1

0.1.0.0 https://github.com/lncd/OAuth2-Client

OAuth 2.0 Client Library

  Sources   Download

MIT

The Requires

 

The Development Requires

authentication authorization oauth sso oauth2 identity idp single sign on

25/03 2013

dev-develop

dev-develop https://github.com/lncd/OAuth2-Client

OAuth 2.0 Client Library

  Sources   Download

MIT

The Requires

 

The Development Requires

authentication authorization oauth sso oauth2 identity idp single sign on