Skip to content

Instantly share code, notes, and snippets.

@petericebear
Last active January 26, 2017 07:18
Show Gist options
  • Save petericebear/77711bd21d101a58adfb31d240c60a67 to your computer and use it in GitHub Desktop.
Save petericebear/77711bd21d101a58adfb31d240c60a67 to your computer and use it in GitHub Desktop.
laravel-mollie get access token from refresh token
<?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