chadhutchins / oauth2-suitecrm
SuiteCRM OAuth 2.0 Client Provider for The PHP League OAuth2-Client
1.0.3
2021-09-23 16:15 UTC
Requires
- league/oauth2-client: ^2.0
Requires (Dev)
- mockery/mockery: ~0.9
- phpunit/phpunit: ~4.0
- squizlabs/php_codesniffer: ~2.0
This package is auto-updated.
Last update: 2024-10-23 23:08:27 UTC
README
This package provides SuiteCRM OAuth 2.0 support for the PHP League's OAuth 2.0 Client.
Installation
To install, use composer:
composer require chadhutchins/oauth2-suitecrm
Usage
Usage is the same as The League's OAuth client, using \Chadhutchins\OAuth2\Client\Provider\SuiteCRM
as the provider.
Authorization Code Flow
$provider = new \League\OAuth2\Client\Provider\GenericProvider([ 'clientId' => 'SuiteCRM Client ID', // The client ID assigned to you by the provider 'clientSecret' => 'SuiteCRM Client Secret', // The client password assigned to you by the provider 'redirectUri' => 'https://my.example.com/your-redirect-url/', 'urlAuthorize' => 'https://your-suitecrm-instance.com/Api/authorize', // not used but still required by library 'urlAccessToken' => 'https://your-suitecrm-instance.com/Api/access_token', 'urlResourceOwnerDetails' => 'https://your-suitecrm-instance/Api/V8/meta/modules', ]); try { // Try to get an access token using the resource owner password credentials grant. $accessToken = $provider->getAccessToken('password', [ 'username' => 'suitecrm_username', 'password' => 'suietcrm_password' ]); } catch (\League\OAuth2\Client\Provider\Exception\IdentityProviderException $e) { // Failed to get the access token exit($e->getMessage()); }
Managing Scopes
SuiteCRM does not support scopes at this time. Limit access using ACL controls on the user you authenticate with.
Testing
$ ./vendor/bin/phpunit
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.