Skip to content

Commit

Permalink
Merge branch 'track-approved-scopes' into 5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jan 27, 2022
2 parents 4b19992 + 94cf54c commit d5891f1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Two/AbstractProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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', '')));
}

/**
Expand Down
20 changes: 20 additions & 0 deletions src/Two/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ class User extends AbstractUser
*/
public $expiresIn;

/**
* The scopes the user authorized. The approved scopes may be a subset of the requested scopes.
*
* @var array
*/
public $approvedScopes;

/**
* Set the token on the user.
*
Expand Down Expand Up @@ -65,4 +72,17 @@ public function setExpiresIn($expiresIn)

return $this;
}

/**
* Set the scopes that were approved by the user during authentication.
*
* @param array $approvedScopes
* @return $this
*/
public function setApprovedScopes($approvedScopes)
{
$this->approvedScopes = $approvedScopes;

return $this;
}
}

0 comments on commit d5891f1

Please sign in to comment.