From 51a683800719ee0b24b3b7db2b84daec5af1d591 Mon Sep 17 00:00:00 2001 From: DraperStudio Date: Fri, 3 Jun 2016 19:59:20 +0200 Subject: [PATCH] Add parseRefreshToken & parseExpiresIn methods --- src/OAuth2/AbstractProvider.php | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) 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'); + } }