https://github.com/mapado/league-oauth2-provider
phpleague OAuth2 provider for Mapado
https://github.com/mapado/league-oauth2-provider
Last synced: about 1 month ago
JSON representation
phpleague OAuth2 provider for Mapado
- Host: GitHub
- URL: https://github.com/mapado/league-oauth2-provider
- Owner: mapado
- License: mit
- Created: 2018-08-24T15:23:32.000Z (almost 8 years ago)
- Default Branch: main
- Last Pushed: 2023-09-15T07:55:20.000Z (almost 3 years ago)
- Last Synced: 2025-01-10T01:02:16.674Z (over 1 year ago)
- Language: PHP
- Size: 23.4 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# league-oauth2-provider [](https://travis-ci.org/mapado/league-oauth2-provider)
[phpleague OAuth2](http://oauth2-client.thephpleague.com/) provider for Mapado
## Installation
```sh
composer require mapado/league-oauth2-provider
```
## Usage
Usage is the same as The League's OAuth client, using `\Mapado\LeagueOAuth2Provider\Provider\MapadoOAuth2Provider` as the provider.
### Get an client_credentials access token
```php
$provider = new \Mapado\LeagueOAuth2Provider\Provider\MapadoOAuth2Provider([
'clientId' => '{mapado-client-id}',
'clientSecret' => '{mapado-client-secret}',
]);
$provider->getAccessToken('client_credentials', [
'scope' => 'scope1 scope2',
]);
```
### Get a password access token
```php
$provider = new \Mapado\LeagueOAuth2Provider\Provider\MapadoOAuth2Provider([
'clientId' => '{mapado-client-id}',
'clientSecret' => '{mapado-client-secret}',
]);
$provider->getAccessToken('password', [
'scope' => 'scope1 scope2',
'username' => 'username',
'password' => 'password',
]);
```
Both call should return a instance of `League\OAuth2\Client\Token\AccessToken`. See the [phpleague OAuth2 client documentation](http://oauth2-client.thephpleague.com/) for more informations.