deminoth / oauth2-naver
Naver provider for league/oauth2-client
v0.1
2014-12-29 05:24 UTC
Requires
- php: >=5.5.0
- league/oauth2-client: ~0.3
Requires (Dev)
- mockery/mockery: 0.9.*
- phpunit/phpunit: 4.2.*
This package is not auto-updated.
Last update: 2024-11-19 10:20:11 UTC
README
Naver provider for league/oauth2-client
To install, use composer:
composer require deminoth/oauth2-naver
Usage is the same as the league's OAuth client, using \Deminoth\OAuth2\Client\Provider\Naver
as the provider.
For example:
$provider = new \Deminoth\OAuth2\Client\Provider\Naver([ 'clientId' => "YOUR_CLIENT_ID", 'clientSecret' => "YOUR_CLIENT_SECRET", 'redirectUri' => "http://your-redirect-uri" ]); if (isset($_GET['code']) && $_GET['code']) { $token = $this->provider->getAccessToken("authorizaton_code", [ 'code' => $_GET['code'] ]); $user = $this->provider->getUserDetails($token); // $user->uid = [ encoded Naver ID ] // $user->nickname = [ Naver nickname ] // $user->imageUrl = [ Profile Image ] // $user->email = [ ID@naver.com ] }