|
@@ 44-57 (lines=14) @@
|
| 41 |
|
* @param string $tokenCode The code parameter returned to your redirect URI when the user authorized your app. Or a refresh token. |
| 42 |
|
* @return \SevenShores\Hubspot\Http\Response |
| 43 |
|
*/ |
| 44 |
|
function getTokensByCode($clientId, $clientSecret, $redirectURI, $tokenCode) |
| 45 |
|
{ |
| 46 |
|
$options['form_params'] = [ |
| 47 |
|
'grant_type' => 'authorization_code', |
| 48 |
|
'client_id' => $clientId, |
| 49 |
|
'client_secret' => $clientSecret, |
| 50 |
|
'redirect_uri' => $redirectURI, |
| 51 |
|
'code' => $tokenCode |
| 52 |
|
]; |
| 53 |
|
|
| 54 |
|
$options['headers']['content-type'] = 'application/x-www-form-urlencoded'; |
| 55 |
|
|
| 56 |
|
return $this->client->request('post', $this->endpoint.'/token', $options); |
| 57 |
|
} |
| 58 |
|
|
| 59 |
|
/** |
| 60 |
|
* Get OAuth 2.0 Access Token and Refresh Tokens by using a refresh token |
|
@@ 68-80 (lines=13) @@
|
| 65 |
|
* @param string $refreshToken The refresh token. |
| 66 |
|
* @return \SevenShores\Hubspot\Http\Response |
| 67 |
|
*/ |
| 68 |
|
function getTokensByRefresh($clientId, $clientSecret, $refreshToken) |
| 69 |
|
{ |
| 70 |
|
$options['form_params'] = [ |
| 71 |
|
'grant_type' => 'refresh_token', |
| 72 |
|
'client_id' => $clientId, |
| 73 |
|
'client_secret' => $clientSecret, |
| 74 |
|
'refresh_token' => $refreshToken |
| 75 |
|
]; |
| 76 |
|
|
| 77 |
|
$options['headers']['content-type'] = 'application/x-www-form-urlencoded'; |
| 78 |
|
|
| 79 |
|
return $this->client->request('post', $this->endpoint.'/token', $options); |
| 80 |
|
} |
| 81 |
|
|
| 82 |
|
/** |
| 83 |
|
* Get Information for OAuth 2.0 Access Token |