xmyl/oauth

This is a oauth2 login.

Maintainers

Details

github.com/xmyl/oauth

Source

Issues

Installs: 1

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/xmyl/oauth

dev-master 2019-10-17 08:45 UTC

This package is auto-updated.

Last update: 2025-12-17 22:15:53 UTC


README

This is a oauth2 login.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist xmyl/oauth:dev-master

or add

"xmyl/oauth": "dev-master"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

Use login

$oauth = new \xmyl\oauth\GithubOAuth2($clientId, $clientSecret, $callbackUrl);
$redirectUri = $oauth->getAuthorizeUrl()

Use callback

$oauth = new \xmyl\oauth\GithubOAuth2($clientId, $clientSecret, $callbackUrl);
$status = $oauth->getAccessToken($code);
if (!$status) {
    throw new \Exception('Access Token error');
}

$oauthUser = $oauth->getUserByApi();