2017 © Pedro Peláez
 

library oauth2-weibo

Weibo OAuth 2.0 Client Provider for The PHP League OAuth2-Client

image

spoonwep/oauth2-weibo

Weibo OAuth 2.0 Client Provider for The PHP League OAuth2-Client

  • Wednesday, October 25, 2017
  • by chengcheng
  • Repository
  • 1 Watchers
  • 2 Stars
  • 28 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 2 Open issues
  • 7 Versions
  • 4 % Grown

The README.md

oauth2-weibo

Weibo OAuth 2.0 support for the PHP League's OAuth 2.0 Client, (*1)

Install

You can open a terminal and type in, (*2)

composer require spoonwep/oauth2-weibo

or require in a composer.json, (*3)

"require": {
    "spoonwep/oauth2-weibo": "^1.2"
}

then run:, (*4)

composer update

Useage

session_start();
$provider = new \spoonwep\OAuth2\Client\Provider\Weibo([
    'clientId' => '{weibo App Key}',
    'clientSecret' => '{weibo App Secret}',
    'redirectUri' => '{http://example.com/callback-url}',
]);
if (!isset($_GET['code'])) {
    $authUrl = $provider->getAuthorizationUrl();
    $_SESSION['oauth2state'] = $provider->getState();
    header('Location: '.$authUrl);
    exit;
} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {
    unset($_SESSION['oauth2state']);
    exit('Invalid state');
} else {
    $token = $provider->getAccessToken('authorization_code', [
        'code' => $_GET['code']
    ]);

    //fetch userinfo returned by serverside
    $user = $provider->getResourceOwner($token);
    print_r($user->toArray());
}

License

The MIT License (MIT). Please see License File for more information., (*5)

The Versions

25/10 2017

dev-master

9999999-dev

Weibo OAuth 2.0 Client Provider for The PHP League OAuth2-Client

  Sources   Download

MIT

The Requires

 

authorization oauth client oauth2 authorisation weibo

25/10 2017

1.2.3

1.2.3.0

Weibo OAuth 2.0 Client Provider for The PHP League OAuth2-Client

  Sources   Download

MIT

The Requires

 

authorization oauth client oauth2 authorisation weibo

25/10 2017

1.2.2

1.2.2.0

Weibo OAuth 2.0 Client Provider for The PHP League OAuth2-Client

  Sources   Download

MIT

The Requires

 

authorization oauth client oauth2 authorisation weibo

25/10 2017

1.2.1

1.2.1.0

Weibo OAuth 2.0 Client Provider for The PHP League OAuth2-Client

  Sources   Download

MIT

The Requires

 

authorization oauth client oauth2 authorisation weibo

05/08 2016

1.1.1

1.1.1.0

Weibo OAuth 2.0 Client Provider for The PHP League OAuth2-Client

  Sources   Download

MIT

The Requires

 

authorization oauth client oauth2 authorisation weibo

05/08 2016

1.2

1.2.0.0

Weibo OAuth 2.0 Client Provider for The PHP League OAuth2-Client

  Sources   Download

MIT

The Requires

 

authorization oauth client oauth2 authorisation weibo

25/01 2016

1.0

1.0.0.0

Weibo OAuth 2.0 Client Provider for The PHP League OAuth2-Client

  Sources   Download

MIT

The Requires

 

authorization oauth client oauth2 authorisation weibo