Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add/set approvedScopes in User #572

Merged
merged 5 commits into from Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Two/AbstractProvider.php
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
18 changes: 18 additions & 0 deletions src/Two/User.php
Expand Up @@ -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.
*
Expand Down Expand Up @@ -65,4 +72,15 @@ public function setExpiresIn($expiresIn)

return $this;
}

/**
* @param array $approvedScopes
* @return $this
*/
public function setApprovedScopes($approvedScopes)
{
$this->approvedScopes = $approvedScopes;

return $this;
}
}