Marketo OAuth 2.0 support for the PHP League's OAuth2-Client

v1.5 2016-10-03 14:32 UTC

This package is not auto-updated.

Last update: 2024-07-10 20:20:23 UTC


Latest Version Software License Build Status Coverage Status Quality Score VersionEye Total Downloads

This package provides Marketo OAuth 2.0 support for the PHP League's OAuth 2.0 Client.


To install, use composer:

composer require kristenlk/oauth2-marketo


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.

$provider = new \Kristenlk\OAuth2\Client\Provider\Marketo([
    'clientId'          => '{marketo-client-id}',
    'clientSecret'      => '{marketo-client-secret}',
    'baseUrl'           => ''

// 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.


$ ./vendor/bin/phpunit


Please see CONTRIBUTING for details.



The MIT License (MIT). Please see License File for more information.