Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It's possible for a user to grant a subset of the requested scopes. Google has been pushing this recently...see the attached screenshot of their latest Oauth page. Their latest default is to have no scopes checked making it quite easy for a user to select a subset of the requested scopes.
Part of the Oauth flow suggests the providers should return the approved scopes as part of the
code -> access_token
exchange if the user auth'ed a subset of the requested scopes. In my testing of Google, M365, Slack, and Zoom, thescope
field is always returned as part of thecode -> access_token
exchange.There was a recent issue asking for this feature.
As pointed out in the link within issue#568, we should expect
code
->access_token
,refresh_token (optional)
,expires_at
,scope (optional)
There was a recent PR which brought the
User
class up from justaccess_token
to also includerefresh_token
, andexpires_at
.This PR also brings in
scope
to theUser
object. That would complete theUser
object for storing everything thecode -> access_token
exchange returns.Would you like to merge this up stream? If so, I can do whatever I can to make this acceptable up steam. I tested this with the providers we are using. I can also put in a PR for the SocialiteProviders manager. In SocialiteProviders, it's much like this PR but we set the scopes here and add a
parseApprovedScopes
function like the others in that file.Tested with native Oauth Provider:
Tested with SocialiteProviders (needs a simple PR):
If it's helpful, here are a few documents showing the
scope
field gets returned from a auth code to access token exchange