diff --git a/src/OAuth2/AbstractProvider.php b/src/OAuth2/AbstractProvider.php index e26e9f4..4728945 100644 --- a/src/OAuth2/AbstractProvider.php +++ b/src/OAuth2/AbstractProvider.php @@ -45,8 +45,8 @@ public function user() } return $user->setToken($token) - ->setRefreshToken(Arr::get($response, 'refresh_token')) - ->setExpiresIn(Arr::get($response, 'expires_in')); + ->setRefreshToken($this->parseRefreshToken($response)) + ->setExpiresIn($this->parseExpiresIn($response)); } /** @@ -60,4 +60,28 @@ protected function parseAccessToken($body) { return Arr::get($body, 'access_token'); } + + /** + * Get the refresh token from the token response body. + * + * @param string $body + * + * @return string + */ + protected function parseRefreshToken($body) + { + return Arr::get($body, 'refresh_token'); + } + + /** + * Get the expires in from the token response body. + * + * @param string $body + * + * @return string + */ + protected function parseExpiresIn($body) + { + return Arr::get($body, 'expires_in'); + } }