diff --git a/src/Two/AbstractProvider.php b/src/Two/AbstractProvider.php index 06f00e5a..e928b4f1 100644 --- a/src/Two/AbstractProvider.php +++ b/src/Two/AbstractProvider.php @@ -244,7 +244,8 @@ public function user() return $this->user->setToken($token) ->setRefreshToken(Arr::get($response, 'refresh_token')) - ->setExpiresIn(Arr::get($response, 'expires_in')); + ->setExpiresIn(Arr::get($response, 'expires_in')) + ->setApprovedScopes(explode($this->scopeSeparator, Arr::get($response, 'scope', ''))); } /** diff --git a/src/Two/User.php b/src/Two/User.php index 0f31b640..b1087cc6 100644 --- a/src/Two/User.php +++ b/src/Two/User.php @@ -27,6 +27,13 @@ class User extends AbstractUser */ public $expiresIn; + /** + * The scopes the users authorized. These may be a subset of the requested scopes. + * + * @var array + */ + public $approvedScopes; + /** * Set the token on the user. * @@ -65,4 +72,15 @@ public function setExpiresIn($expiresIn) return $this; } + + /** + * @param array $approvedScopes + * @return $this + */ + public function setApprovedScopes($approvedScopes) + { + $this->approvedScopes = $approvedScopes; + + return $this; + } }