Skip to content

Commit

Permalink
Add parseRefreshToken & parseExpiresIn methods
Browse files Browse the repository at this point in the history
  • Loading branch information
DraperStudio committed Jun 3, 2016
1 parent 5b70ebc commit 51a6838
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions src/OAuth2/AbstractProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

/**
Expand All @@ -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');
}
}

0 comments on commit 51a6838

Please sign in to comment.