-
Notifications
You must be signed in to change notification settings - Fork 790
Description
Description
If I am running two apps, app.my-app.test and admin.my-app.test, both of them are first party applications, and I am using the auth code grant or implicit grant to authorize admin.my-app.test with the Passport server running on app.my-app.test, the user will currently see a consent dialog like this:
Since both of these applications are first party apps I would like to be able to skip the consent dialog.
A good example of this is Google. If you go to mail.google.com and are not logged in, you will be redirected to accounts.google.com. You will not see a consent screen but instead will continue to the normal login screen.
Another example of this is Auth0 - they let you skip the consent dialog for first party apps.
Otka lets you specify what scopes should require consent.
edit: Looks like doorkeeper in ruby, Django OAuth Toolkit, and IdentityServer in .NET support this too.
The OAuth 2.0 IETF doc allows this explicitly:
If the request is valid,
the authorization server authenticates the resource owner and obtains
an authorization decision (by asking the resource owner or by
establishing approval via other means).
Rationale
Developers (understandably) don't want to show a consent screen for their own apps. I've seen developers reach for the password grant instead because there is no consent screen involved.
The password grant doesn't allow you to prompt user for multi factor authentication, use social login, etc, doesn't support single sign on, and trains users to get phished. It's less secure and shouldn't really be used.
Skipping the consent screen is already supported by other major OAuth providers. It doesn't create a security risk as long as it's limited to first party clients.
It's currently difficult to add this yourself. You have to override the Authorization controller which requires copying ~30 lines of code. Then you have to register a route but it needs to be registered after the AuthServiceProvider runs; otherwise Passport overwrites it.
Implementation Thoughts
We would need a way to determine if the client is first party or not. Maybe add a boolean column?
Alternatively we could allow registering a callback, i.e.
Passport::canSkipConsent(function (Client $client) {
return $client->isFirstParty(); // This is a made up method the user added themselves
});I like the idea of the callback because it's backwards compatible and flexible enough to accommodate any use case.
Maybe in the next major version the callback could default to $client->isFirstParty() and we could add the boolean column?
I'd be willing to write the PR. What do you think?
