-
Notifications
You must be signed in to change notification settings - Fork 3
/
KristenlkMarketoProvider.php
47 lines (42 loc) · 1.14 KB
/
KristenlkMarketoProvider.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
namespace EventFarm\Marketo\Oauth;
use Kristenlk\OAuth2\Client\Provider\Marketo;
class KristenlkMarketoProvider implements MarketoProviderInterface
{
/**
* @var Marketo
*/
public $marketo;
public static function createDefaultProvider(
string $clientId,
string $clientSecret,
string $baseUrl
) {
return new self(
new Marketo([
'clientId' => $clientId,
'clientSecret' => $clientSecret,
'baseUrl' => $baseUrl
])
);
}
public function __construct(Marketo $marketo)
{
$this->marketo = $marketo;
}
/**
* Requests an access token using a specified grant and option set.
*
* @param mixed $grant
* @param array $options
* @return AccessTokenInterface
*/
public function getAccessToken($grant, array $options = []):AccessTokenInterface
{
$marketoAccessToken = $this->marketo->getAccessToken($grant, $options);
return new AccessToken(
$marketoAccessToken->getToken(),
$marketoAccessToken->getExpires()
);
}
}