Last active
January 26, 2017 07:18
-
-
Save petericebear/77711bd21d101a58adfb31d240c60a67 to your computer and use it in GitHub Desktop.
laravel-mollie get access token from refresh token
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function getRefreshTokenResponse($code) | |
{ | |
$response = $this->getHttpClient()->post($this->getTokenUrl(), [ | |
'headers' => ['Accept' => 'application/json'], | |
'form_params' => $this->getRefreshTokenFields($code), | |
]); | |
return json_decode($response->getBody(), true); | |
} | |
public function getRefreshTokenFields($code) | |
{ | |
return [ | |
'client_id' => $this->clientId, | |
'client_secret' => $this->clientSecret, | |
'code' => $code, | |
'grant_type' => 'refresh_token', | |
'refresh_token' => $code, | |
]; | |
} | |
// works with | |
$result = Socialite::with('mollie') | |
->scopes($scopes) | |
->getRefreshTokenResponse($refreshToken); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment