Repository navigation
fix(oauth): resume social login through /authorize (#855) - #899
Merged
Merged
Conversation
/oauth_login and /oauth_callback held redirect_uri to --allowed-origins and delivered the authorization code themselves, so a client whose registered callback is on another origin could not use social login, and an /authorize-originated social login skipped the consent gate. Social login may now return to this server's own /app (exact path, same scheme and host:port), which replays the request to /authorize — the same resumption password login already uses. On that hop the callback sets the session only: no code is minted and nothing is appended, so the client's nonce survives into the id_token. - meta: is_social_login_authorize_resume_supported (GraphQL + gRPC) so login UIs adopt the resume path only against a server that supports it - the old direct path is unchanged but logs a deprecation warning when it completes an /authorize request; a later release refuses it
is_social_login_authorize_resume_supported protected nothing: /authorize only ever sends users to this server's own /app, and that login page is built into the same image as the server, so it cannot run against a server that lacks the resume path. Compatibility is documented instead (authorizerdev/docs#98). Schema, proto and generated code are back to main. Adds a subtest for social login started on /app with no /authorize request, the one behaviour this change alters for default deployments: it now returns to /app without state/nonce appended, which nothing on /app reads.
/authorize redirects to /app and the /app route group 301s that to /app/, so a browser renders the login page at /app/?... and that is the URL the login page sends back as redirect_uri. Requiring exactly /app refused it. Found by driving the flow in a real browser (e2e-playground); every Go test had used /app. /app/signup has no such redirect (its trailing-slash form 301s to it), so the accepted set is /app, /app/ and /app/signup.
lakhansamani
added a commit
to authorizerdev/authorizer-react
that referenced
this pull request
Nov 17, 2026
…orizer#855) (#75) * fix(social-login): resume /authorize on Authorizer's login page When /authorize opens Authorizer's login page (/app, /app/ or /app/signup), AuthorizerSocialLogin now sends that page's own URL as redirect_uri, with the /authorize parameters in the query string, instead of the client's callback. The login comes back to /app, which replays the request to /authorize: the client's registered redirect_uri is checked, consent runs, and PKCE is bound. Fixes authorizerdev/authorizer#855. Applies only when the page's origin equals authorizerURL and its URL has client_id and response_type; everywhere else the redirect_uri is unchanged. Requires Authorizer 2.4.6+ (authorizerdev/authorizer#899). * chore(lint): migrate ESLint to flat config so lint runs eslint.config.js used the legacy .eslintrc object shape, which ESLint 9 treats as a flat config with no file matches, so 'npm run lint' ignored every file. Rewrite it as a flat config with the same intent (eslint:recommended, @typescript-eslint recommended, react recommended, react-hooks recommended, same rule overrides, browser/es2021/node globals, React version detect). - add @eslint/js and globals as direct devDependencies (were only transitive; globals was hoisted at v11) - drop the unsupported --ext flag from the lint script - set @typescript-eslint/no-explicit-any to warn (~40 pre-existing anys) - fix the remaining findings: unescaped apostrophes, Function type, prefer-const, unused catch binding, decorator display name, useless regex escapes, unnecessary @ts-ignore
This was referenced Nov 17, 2026
Merged
lakhansamani
added a commit
to authorizerdev/docs
that referenced
this pull request
Nov 17, 2026
* docs: social login resumes through /authorize (2.4.6) Documents authorizerdev/authorizer#899 (fixes authorizerdev/authorizer#855): how social login inside an /authorize request now returns to /app and resumes through /authorize, what /oauth_login accepts as redirect_uri, what the callback appends, the compatibility matrix for hosted, custom and direct login UIs, the deprecated direct path and its log warning, and two Common Issues rows. Also documents redirect_uri on /oauth_login (redirectURL is the deprecated alias) and fixes the sample's role= to roles=. * docs: worked examples for social login inside /authorize - oauth2-oidc: redirect_uri acceptance table, a full hop-by-hop round trip (including the /app -> /app/ redirect), a plain-JS customised login page, a before/after for older login pages, and a browser test step in the Testing Guide - authorizer-react: where AuthorizerSocialLogin returns the user, with examples for your own site, a per-screen landing page, and Authorizer's login page during /authorize (2.2.1+, Authorizer 2.4.6+) - endpoints: sample URLs for both /oauth_login forms - the login page's real path is /app/ (Authorizer 301s /app), so the accepted set is /app, /app/ and /app/signup
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.
Fixes #855. Docs: authorizerdev/docs#98.
Problem
/oauth_loginand/oauth_callbackcheckedredirect_urionly against the global--allowed-origins, and on an/authorize-originated login they minted the authorization code themselves and sent it straight to the client. That caused two problems:/authorizeand/app, then got400 invalid redirect uriat social login. The only workaround was adding the client's origin to--allowed-origins, which also loosens CORS, the CSRF origin check and every token-carrying redirect, for every client./authorize(authorize.go:701). Social login bypassed it. Today only the allowed-origins check prevents a self-registered client from getting a consent-free code through social login, so simply letting/oauth_loginaccept the client's registered callbacks would have opened account takeover.Fix
Social login now ends the same way password login already does (
web/app/src/Root.tsx): it returns to this server's/app, which replays the original request to/authorize./authorizethen validates the client's registeredredirect_uri, runs consent and PKCE, and issues the code. This is Auth0's model too: social login is part of the/authorizetransaction, the provider returns to the server's own callback, and only/authorizeredirects to the app's registered callback.isAuthorizeResumeTarget:/oauth_loginand/oauth_callbackalso accept this server's own/app,/app/or/app/signup./app/is the URL a browser is actually on:/authorizeredirects to/app, and the/approute group 301s that to/app/. That means the same scheme and host:port (from--url), the exact path, and no userinfo or fragment. Nothing else is loosened: client origins are still not accepted here./authorizeissues one after consent), and it redirects to the/appURL unchanged. Appendingstate/noncewould let/appforward the callback's random nonce instead of the client's./authorizerequest. A later release will refuse it.No API, schema, proto or storage changes.
Backward compatibility
@authorizerdev/authorizer-reactkeep sending the client callback directly, and that path behaves exactly as before. The only addition is the warning when it completes an/authorizerequest./authorizeonly ever sends users to this server's own/app, and that page is built into the same image as the server. So the login UI that uses the resume path can never run against a server without it. Compatibility is documented in docs: social login resumes through /authorize (2.4.6) docs#98 instead./app, with no/authorizerequest, used to return to/app?state=…&nonce=…, and only under a bare*. It now returns to/appunchanged, under any--allowed-originslist. Nothing on/appreads either parameter (checked inRoot.tsxand theauthorizer-reactbundle), and there's a subtest for it.prompt/max_agearen't forwarded to/app, so a resumed request can't force re-login in a loop.mfa_*parameters.--urlunset (tests and library embedders only), spoofing the host header affects only the sender's own request; the callback re-checks the host from the real browser request.Tests
TestSocialLoginResumesThroughAuthorize(integration) drives the real handler chain against a mock GitHub:/authorize→/app→/oauth_login/github→ mock IdP →/oauth_callback/github→/authorize→/oauth/token. Its cases:https://app.example.org/auth/callback, with--allowed-origins=http://localhost:3000. The code reaches the client, the token exchange succeeds, and theid_tokennonceis the client's own./oauth_loginstill refuses this server's/graphql,/app/../graphql,/app#…,/appon another origin, and a client callback outside--allowed-origins.redirect_uristill gets the direct redirect with its parameters appended./app: social login with no/authorizerequest lands on/app, signed in.main, the /oauth_login and /oauth_callback ignore a client's registered redirect_uris (social login fails with "invalid redirect uri" for clients on other origins) #855 and consent cases fail withinvalid redirect uri.TestIsAuthorizeResumeTarget(unit) covers scheme downgrade, port, host case, lookalike host, path variants, fragment, userinfo, relative URLs andjavascript:.Verification (local, go1.27.4)
Real browser (
e2e-playground, Playwright): with this branch and the matchingauthorizer-reactchange built into the image, a self-registered client whose callback is outside--allowed-originscompletes GitHub login. The button sends the/app/URL, the user sees consent before anything reaches the client, and the code redeems with the client'snonce. This run is what found the/app/case, which every Go test had missed by using/app. The spec lands with the PR that bumpsauthorizer-reactinweb/app, since it needs that change to pass.go build ./...,go vet ./...make lint(golangci-lint 0 issues, prettier clean)buf lint,make proto-breakingmake testpasses;make smokepasses (GraphQL + REST + gRPC + MCP)Follow-ups
@authorizerdev/authorizer-react: when the page is served from the Authorizer origin and its URL carries/authorizeparameters, the social buttons sendredirect_uri= the current/app?…URL, with the parameters in the query string. Bump it inweb/appbefore 2.4.6, which docs: social login resumes through /authorize (2.4.6) docs#98 assumes./authorize-originated social login that targets anything other than/app, behind an upgrade note.oauth_sso.goandsaml_sp.go, which also consume the/authorizestate and may deliver the code the same direct way.