SocialiteProviders / Providers

A Collection of Providers for Laravel Socialite
https://socialiteproviders.com
MIT License
487 stars 435 forks source link

Laravel Passport fails to return approved scopes #1229

Open zorenkonte opened 4 days ago

zorenkonte commented 4 days ago

Laravel Passport is not returning approved scopes, unlike other providers such as GitHub and Google.

When logging the response in the user method, the response is:

array (
  'token_type' => 'Bearer',
  'expires_in' => 31536000,
  'access_token' => 'access_token',
  'refresh_token' => 'refresh_token',
) 

As a result, setApprovedScopes($this->parseApprovedScopes($response)) consistently returns null.

Steps to Reproduce:

  1. Redirect call

    Socialite::driver('laravelpassport')
                ->scopes(['user:email'])
                ->stateless()
                ->redirect()->getTargetUrl()
  2. Callback call

    Socialite::driver('laravelpassport')->stateless()->user()

The expected behavior is for the approved scopes to match those requested during authorization, as observed with other providers.

image

Screenshots

  1. Laravel Passport Response (Scopes are Empty)

    image
  2. GitHub Response (Scopes are Returned).

    // Result if you log the response of GitHub in the user() method. It returns 'scope' property.
    array (
    'access_token' => 'token',
    'token_type' => 'bearer',
    'scope' => 'user:email',
    )  
image