seinopsys / oauth2-deviantart
DeviantArt OAuth 2.0 Client Provider for The PHP League OAuth2-Client
Installs: 1 517
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=7.1
- league/oauth2-client: ^2.3
Requires (Dev)
- mockery/mockery: ^0.9.9
- phpunit/phpunit: ^5.7
- ramsey/uuid: ^3.0
This package is auto-updated.
Last update: 2024-09-29 04:07:02 UTC
README
DeviantArt OAuth 2.0 support for the PHP League’s OAuth 2.0 Client.
Installation
$ composer require seinopsys/oauth2-deviantart
Usage
You can get your OAuth client credentials here.
$provider = new SeinopSys\OAuth2\Client\Provider\DeviantArtProvider([ 'clientId' => 'client_id', 'clientSecret' => 'client_secret', 'redirectUri' => 'http://example.com/auth', ]); $accessToken = $provider->getAccessToken('authorization_code', [ 'code' => $_GET['code'], 'scope' => ['user','browse'] // optional, defaults to ['user'] ]); $actualToken = $accessToken->getToken(); $refreshToken = $accessToken->getRefresh(); // Once it expires $newAccessToken = $provider->getAccessToken('refresh_token', [ 'refresh_token' => $refreshToken ]);