bordieris / oauth2-freelancer
Freelancer OAuth 2.0 Client Provider for The PHP League OAuth2-Client
dev-master
2020-06-17 21:45 UTC
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: 2025-02-18 07:56:42 UTC
README
Freelancer OAuth 2.0 support for the PHP League’s OAuth 2.0 Client.
Installation
$ composer require bordieris/oauth2-freelancer
Usage
You can get your OAuth client credentials here.
$provider = new Bordieris\OAuth2\Client\Provider\FreelancerProvider([ 'clientId' => 'client_id', 'clientSecret' => 'client_secret', 'redirectUri' => 'http://example.com/auth', ]); $accessToken = $provider->getAccessToken('authorization_code', [ 'code' => $_GET['code'], 'scope' => ['basic', 'fln:project_create', 'fln:project_manage'] // optional, defaults to ['basic'] ]); $actualToken = $accessToken->getToken(); $refreshToken = $accessToken->getRefresh(); // Once it expires $newAccessToken = $provider->getAccessToken('refresh_token', [ 'refresh_token' => $refreshToken ]);