Manager icon indicating copy to clipboard operation
Manager copied to clipboard

Set approvedScopes attribute as in Socialite

Open omarcinkonis opened this issue 1 year ago • 1 comments

Issue / Motivation:

socialite/src/Two/AbstractProvider.php:261 sets approvedScopes attribute:

->setApprovedScopes(explode($this->scopeSeparator, Arr::get($response, 'scope', '')));

In SocialiteProviders/Manager, the attribute is not set. It is always null.

Expected behavior:

socialiteproviders/manager/src/OAuth2/AbstractProvider.php user() method should set approvedScopes, as in Socialite.

Actual behavior:

approvedScopes attribute is not set, the attribute is always null. Users of the package must manually extract approved scopes from response, if scopes are needed.

Steps to reproduce the behavior:

  1. Use any provider from socialiteproviders
  2. Authorize a social network
  3. Call user() and check approvedScopes attribute
  4. approvedScopes will be null

Proposed solution:

Include the code from Socialite user() method:

->setApprovedScopes(explode($this->scopeSeparator, Arr::get($response, 'scope', '')));

omarcinkonis avatar Oct 17 '23 12:10 omarcinkonis

Closed in #229

atymic avatar May 04 '24 07:05 atymic