nitromike502 / ebay-api-oauth2
eBay OAuth 2 Client Provider for The PHP League OAuth2-Client package
dev-master
2020-08-21 02:50 UTC
Requires
- league/oauth2-client: ^2.0
Requires (Dev)
- phpunit/phpunit: ^6.0
- squizlabs/php_codesniffer: ^3.5
This package is auto-updated.
Last update: 2025-06-21 13:27:29 UTC
README
This package provides an eBay OAuth 2.0 support for the PHP League's OAuth 2.0 Client.
Installation
To install, use composer:
composer require nitromike502/ebay-api-oauth2
Usage
Usage is the same as The League's OAuth client, using \Nitromike502\OAuth2\Client\Provider\Ebay
as the provider.
Authorization Code Flow
$provider = new Nitromike502\OAuth2\Client\Provider\Ebay([ 'clientId' => '{ebay-client-id}', 'clientSecret' => '{ebay-client-secret}', 'redirectUri' => '{redirect-code}' ]);
For further usage of this package please refer to the core package documentation on "Authorization Code Grant".
Refreshing a Token
$provider = new Nitromike502\OAuth2\Client\Provider\Ebay([ 'clientId' => '{ebay-client-id}', 'clientSecret' => '{ebay-client-secret}', 'redirectUri' => '{redirect-code}' ]); $existingAccessToken = getAccessTokenFromYourDataStore(); if ($existingAccessToken->hasExpired()) { $newAccessToken = $provider->getAccessToken('refresh_token', [ 'refresh_token' => $existingAccessToken->getRefreshToken() ]); // Purge old access token and store new access token to your data store. }
For further usage of this package please refer to the core package documentation on "Refreshing a Token".
Testing
$ ./vendor/bin/phpunit
License
The MIT License (MIT). Please see License File for more information.