kristenlk / oauth2-marketo
Marketo OAuth 2.0 support for the PHP League's OAuth2-Client
Installs: 100 382
Dependents: 2
Suggesters: 0
Security: 0
Stars: 4
Watchers: 1
Forks: 5
Open Issues: 1
Requires
- php: >=5.5.0
- league/oauth2-client: ^1.0
Requires (Dev)
- mockery/mockery: ~0.9
- phpunit/phpunit: ~4.0
- squizlabs/php_codesniffer: ~2.0
This package is not auto-updated.
Last update: 2024-11-13 21:53:03 UTC
README
This package provides Marketo OAuth 2.0 support for the PHP League's OAuth 2.0 Client.
Installation
To install, use composer:
composer require kristenlk/oauth2-marketo
Usage
Usage is the same as The League's OAuth client, using \Kristenlk\OAuth2\Client\Provider\Marketo
as the provider.
Authorization Code Flow
Marketo's REST APIs are authenticated with two-legged OAuth 2.0. We don't need to pass a redirectUri to the provider, but we do need to include a base url that will be used to request an access token.
<?php $provider = new \Kristenlk\OAuth2\Client\Provider\Marketo([ 'clientId' => '{marketo-client-id}', 'clientSecret' => '{marketo-client-secret}', 'baseUrl' => 'https://your-base-url.mktorest.com' ]); // Try to get an access token (using the client credentials grant) $token = $provider->getAccessToken('client_credentials'); // Use this to interact with an API on the users behalf echo $token->getToken();
If the access token expires, we can just call getAccessToken() again.
Testing
$ ./vendor/bin/phpunit
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.