Skip to content

Commit

Permalink
Merge pull request #52 from langleyfoxall/fix/refresh-token-grant-type
Browse files Browse the repository at this point in the history
Add Grant Type To Refresh Token.
  • Loading branch information
JordenPowleyWebDev authored May 18, 2022
2 parents e55727e + 7a29436 commit b6fed0c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/OAuth2.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,19 @@ public function getTenants(AccessTokenInterface $accessToken)
* Refreshes an access token, and returns the new access token.
*
* @param AccessTokenInterface $accessToken
* @param string|null $grantType
* @return AccessTokenInterface
* @throws IdentityProviderException
*/
public function refreshAccessToken(AccessTokenInterface $accessToken)
public function refreshAccessToken(AccessTokenInterface $accessToken, string? $grantType = null)
{
return $this->getProvider()->getAccessToken('refresh_token', [
$body = [
'refresh_token' => $accessToken->getRefreshToken()
]);
];

if (isset($grantType) && (trim($grantType) !== "")) {
$body['grant_type'] = $grantType;
}

return $this->getProvider()->getAccessToken('refresh_token', $body);
}
}

0 comments on commit b6fed0c

Please sign in to comment.