https://github.com/compwright/oauth2-fieldedge
FieldEdge OAuth 2.0 support for the PHP League's OAuth 2.0 Client
https://github.com/compwright/oauth2-fieldedge
Last synced: 10 months ago
JSON representation
FieldEdge OAuth 2.0 support for the PHP League's OAuth 2.0 Client
- Host: GitHub
- URL: https://github.com/compwright/oauth2-fieldedge
- Owner: compwright
- License: mit
- Created: 2022-12-09T18:43:26.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2022-12-09T18:47:58.000Z (about 3 years ago)
- Last Synced: 2024-04-23T23:37:14.612Z (over 1 year ago)
- Language: PHP
- Homepage: https://packagist.org/packages/compwright/oauth2-fieldedge
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# FieldEdge Provider for OAuth 2.0 Client
[](https://github.com/compwright/oauth2-fieldedge/releases)
[](https://packagist.org/packages/compwright/oauth2-fieldedge)
This package provides FieldEdge OAuth 2.0 support for the PHP League's [OAuth 2.0 Client](https://github.com/thephpleague/oauth2-client).
## Installation
To install, use composer:
```
composer require compwright/oauth2-fieldedge league/oauth2-client
```
## Usage
Usage is the same as The League's OAuth client, using `\Compwright\OAuth2_Fieldedge\Provider` as the provider.
### Example: Client Credentials Flow
```php
$provider = new Compwright\OAuth2_Fieldedge\Provider([
'clientId' => '{fieldedge-client-id}',
'clientSecret' => '{fieldedge-api-key}',
]);
// Get an access token
$token = $provider->getAccessToken('client_credentials');
// Use the token to interact with an API on the users behalf
echo $token->getToken();
// The token is really a JWT, getResourceOwnerId() extracts the company_id claim
echo $token->getResourceOwnerId();
```
## Testing
```bash
$ make test
```
## Contributing
Please see [CONTRIBUTING](https://github.com/compwright/oauth2-fieldedge/blob/master/CONTRIBUTING.md) for details.
## Credits
- [Jonathon Hill](https://github.com/compwright)
- [All Contributors](https://github.com/compwright/oauth2-fieldedge/contributors)
## License
The MIT License (MIT). Please see [License File](https://github.com/compwright/oauth2-fieldedge/blob/master/LICENSE) for more information.