Skip to content

support for setDefaultScope #870

@corbosman

Description

@corbosman

Hi, the rfc says (https://tools.ietf.org/html/rfc6749#page-23) that when a client does not pass a scope parameter, the server can choose to either return a default set of scopes, or a scope error. Laravel kind of does neither. When I omit the scope parameter laravel simply doesn't set a scope, and doesn't return a scope error.

The league server does support a setDefaultScope method on the AuthorizationServer specifically for this, but unfortunately right now the only way to be able to set that is through the PassportServiceProvider in the registerAuthorizationServer singleton. When you enable a grant, the oauth2 server can set a previously set default scope.

see: https://github.com/thephpleague/oauth2-server/blob/master/src/Grant/AuthCodeGrant.php#L259

It would be nice if we could do a Passport::setDefaultScope([..]) through the AuthServiceProvider, and then have passport set that on the AuthorizationServer before enabling the grants. I implemented that locally as a test and that works great. Would a PR be welcome for this? Or is this not something laravel would want to support?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions