bordieris/oauth2-freelancer

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

dev-master 2020-06-17 21:45 UTC

This package is auto-updated.

Last update: 2024-04-18 06:24:58 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
]);