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

Return scope as a token response param #793

Open
chervand opened this issue Oct 11, 2017 · 6 comments
Open

Return scope as a token response param #793

chervand opened this issue Oct 11, 2017 · 6 comments
Milestone

Comments

@chervand
Copy link

According to https://tools.ietf.org/html/rfc6749#section-5.1

scope
OPTIONAL, if identical to the scope requested by the client;
otherwise, REQUIRED...

and https://tools.ietf.org/html/rfc6749#section-3.3

The authorization server MAY fully or partially ignore the scope
requested by the client, based on the authorization server policy or
the resource owner's instructions. If the issued access token scope
is different from the one requested by the client, the authorization
server MUST include the "scope" response parameter to inform the
client of the actual scope granted. If the client omits the scope parameter when requesting
authorization, the authorization server MUST either process the
request using a pre-defined default value or fail the request
indicating an invalid scope. The authorization server SHOULD
document its scope requirements and default value (if defined).

Is it possible to return scope value as a request param by default to notify clients about actually granted scopes (in case default or omitted ones) without need of parsing JWT?

@DewaldBodenstein
Copy link

@chervand have you found a way to accomplish this?

@chervand
Copy link
Author

@DewaldBodenstein, I believe, adding it to a League\OAuth2\Server\ResponseTypes\BearerTokenResponse $responseParams should be enough.

@DewaldBodenstein
Copy link

Thanks, got it working.

@simonhamp
Copy link

@chervand That's nice. I think in most implementations, if the client requests scopes that aren't supported, the server should respond with an invalid_scope error. However, this is really useful for situations where a scope is valid, but for some other reason has been denied (e.g. authorisation).

And as you rightly mention, it follows spec. In fact, I'd go so far as to say that it's worth having in the response regardless.

Do you fancy making a pull request for this?

@chervand
Copy link
Author

@simonhamp yes, sure

@christiaangoossens
Copy link
Contributor

+1, this would be very useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants