[6.x] OAuth Improvements#14899
Open
jasonvarga wants to merge 24 commits into
Open
Conversation
The direct-login branch set the oauth-provider session key (used to offer OAuth re-auth on session expiry), but the 2FA challenge branch did not, so 2FA users lost that affordance. Set it before deferring to the challenge. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A single shared disconnect route hardcoded the default guard, so a control panel using a distinct cp guard would 401. Split it: the front-end route authenticates via AuthGuard + auth (web guard), and the control panel route lives in the cp routes where it inherits the cp guard and CSRF handling. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This reworks how OAuth sign-ins resolve to user accounts and adds the ability to connect/disconnect providers to an existing account.
Account matching
Matching an OAuth sign-in to an existing user by email address has been removed. Email-based matching is fragile — it assumes the email a provider reports is canonical and verified, which isn't always true, and providers can change or reuse them. Relying on it to identify accounts can be insecure.
Sign-ins now resolve a user by their stored provider ID only. If someone signs in with a provider whose email matches an existing account they haven't linked, they'll be asked to sign in to that account and connect the provider from their account settings instead.
Connecting providers
There is now a page in the control panel for you to manage connections to OAuth accounts (linked from the user edit dropdown, alongside Passkeys).
Front-end tags
For themes that want to build their own connected-accounts UI:
{{ oauth }} ... {{ /oauth }}— loops the available providers. Each item getsname,label,connected, andurl.{{ oauth:disconnect_form provider="..." }}— outputs a form to disconnect a provider{{ oauth:provider_handle }}functions as a "connect" url when already logged in.Connect/disconnect success and failure are flashed to the session and can be rendered with
{{ session:success }}and{{ session:error }}.Two-factor
OAuth sign-ins now respect two-factor authentication.