Repository navigation
Description
Version: 2.4.4 (image digest sha256:d1ce7574a75d409f83ef611d7fab4846da64f3d30595f7d5a2bd0e083a97e28d; main still has the same code at the time of writing)
Describe the bug
Social login (/oauth_login/:provider) does not honour the registered redirect_uris of a client. It only accepts a redirectURL whose origin is listed in --allowed-origins. So for a client registered through /oauth/register (RFC 7591), whose callback is on its own domain, /authorize, /app, the token endpoint and password login all work, but the "Continue with GitHub/Google" buttons on the hosted login page end in:
HTTP 400 {"error":"invalid redirect uri"}
The only workaround is to add every app's origin to the instance-wide --allowed-origins and restart the server. That list is also used for CORS, the GraphQL CSRF check, and the redirect_uri validation of password reset, magic link, sign-up, logout, SSO and SAML, so each new app widens all of those, and a new client can no longer be registered at run time and be complete.
Where it comes from (tag 2.4.4)
internal/http_handlers/oauth_login.go:47validates withvalidators.IsValidRedirectURI(redirectURI, h.Config.AllowedOrigins, hostname). The handler never readsclient_idand never callscheckClientRedirectURI.internal/http_handlers/oauth_callback.go:120repeats the same origin-only check onstatePayload.RedirectURI, so fixing only the login side would not be enough.checkClientRedirectURI(client_redirect.go), the function that applies a client's registeredredirect_uris(and--redirect-urisfor the deployment's own client), is called only fromauthorize.go:178,app.go:60andverify_email.go:53. The comment on it describes exactly this gap for/app("When /app applied a different (AllowedOrigins-only) rule, every client whose registered redirect_uri was not also an allowed origin passed the first check and failed the second")./oauth_loginhas the same shape of problem.- The login page buttons (
@authorizerdev/authorizer-react2.2.0, bundled inweb/app/build) callwindow.location.href = <authorizerURL>/oauth_login/<provider>?state=..&scope=..&redirectURL=<redirect_uri>&redirect_uri=<redirect_uri>&isOrgDiscoveryEnabled=false.client_idis not sent, even when the page was opened with?client_id=...(observed in headless Chromium, for both/app/?client_id=..&redirect_uri=..and the redirect that/authorizeissues).
Steps To Reproduce
Any 2.4.4 instance with a GitHub or Google client configured (fake credentials are enough, validation happens before the redirect to the provider), --allowed-origins=https://auth.example.com, --enable-dynamic-client-registration:
# 1. register a client whose callback is on another domain
curl -s https://auth.example.com/oauth/register -H 'Content-Type: application/json' -d '{
"client_name":"app","redirect_uris":["https://app.example.org/auth/callback"],
"grant_types":["authorization_code","refresh_token"],"response_types":["code"],
"token_endpoint_auth_method":"none"}' # -> {"client_id":"<id>", ...}
# 2. /authorize and /app accept that callback (the login page renders), but the social login does not:
curl -s -o /dev/null -w '%{http_code}\n' --get https://auth.example.com/oauth_login/github \
--data-urlencode state=x --data-urlencode 'redirectURL=https://app.example.org/auth/callback'
# 400 (with or without an extra client_id=<id> parameter)
curl -s -o /dev/null -w '%{http_code}\n' --get https://auth.example.com/oauth_login/github \
--data-urlencode state=x --data-urlencode 'redirectURL=https://auth.example.com/anything/at/all'
# 307 (any path on an allowed origin passes)Measured results (same on a throwaway instance with --redirect-uris=https://app.example.org/auth/callback --client-id <deployment client>): the registered callback stays at 400; --redirect-uris has no effect on /oauth_login, because it is consulted only through checkClientRedirectURI. After adding https://app.example.org to --allowed-origins, the callback and every other path on that origin return 307.
Expected behavior
When the request identifies a client, /oauth_login (and the matching check in /oauth_callback) should validate redirect_uri against that client's registered redirect_uris, exactly like /authorize and /app already do. Without a client_id the current behaviour stays as it is, so existing deployments are unaffected.
Proposed change (happy to send a PR if you agree with the direction)
authorizer-react: includeclient_id(when the page has one) in the query of the social login buttons.OAuthLoginHandler: readclient_id; if present, useh.checkClientRedirectURI(ctx, clientID, redirectURI, hostname)instead ofIsValidRedirectURI(fail closed onerrClientUnavailable, as/authorizedoes); otherwise keep today's origin check.oauthStatePayload: store theclient_id, and make/oauth_callbackre-validateRedirectURIwith the same function and that client, so both ends use the same rule.- Tests next to
app_redirect_uri_test.go/authorize_redirect_uri_test.go: registered callback accepted, unregistered path on the same origin refused for a client with registered URIs, noclient_idunchanged.
Additional context
- Side observation while reading
validators/url.go: origin matching ignores the scheme (http://auth.example.com/xpasses forhttps://auth.example.com) and is case-sensitive on the host. Probably intended, mentioned only in case it is not. - Related: the CHANGELOG entry for
--redirect-urisand the/verify_emailfix (GHSA-44vr-f829-xfch) already move other flows to exact, per-client matching; this would bring social login in line. - We run Authorizer as a shared identity service for several apps, each registered as its own dynamic client. For now we hide the social buttons for clients on other origins at our reverse proxy and accept email + password there.
Activity
fix(oauth): resume social login through /authorize (#855)
fix(oauth): resume social login through /authorize (#855) (#899)
fix(social-login): resume /authorize on Authorizer's login page (auth…
chore: release v2.2.1
Merge pull request #901 from authorizerdev/chore/deps-and-react-2.2.1
docs: social login resumes through /authorize (2.4.6) (#98)
lakhansamani commentedon Nov 17, 2026
Thank you @kurnias for this report. It was precise and easy to reproduce, and it led to a better fix than the obvious one.
This is fixed and released in Authorizer 2.4.6, together with @authorizerdev/authorizer-react 2.2.1, which the hosted login page in 2.4.6 already bundles.
What changed: instead of teaching
/oauth_loginto accept a client's registeredredirect_uri, social login now resumes the original authorization request. That's the same path password login takes, and how Auth0 and others treat social connections:/authorizeis waiting for a sign-in, the login page sends its own/appURL to/oauth_login/<provider>, not the client's callback./oauth_callback/<provider>. The callback signs the user in and goes back to that/appURL, with no code and nothing appended./appreplays the request to/authorize. That checks the client's registered redirect URIs, shows the consent screen if the client needs it, binds PKCE, and sends the code.Why it's done this way: simply accepting the client's callback at
/oauth_loginwould have let a self-registered (DCR) client get a code through social login without the consent screen, because that gate lives in/authorize. Going back through/authorizefixes your case and closes that gap at the same time.What this means for your setup:
--allowed-origins.--allowed-originsas a workaround, you can remove them after upgrading. That list also drives CORS, the CSRF check and email-link redirects for every client.noncecomes back unchanged in the ID token.References:
/app/follow-up and theweb/appbump in chore(deps): combine Dependabot PRs; web/app on authorizer-react 2.2.1 (#855) #901Tests: a new end-to-end test drives exactly this scenario in a real browser: a client outside
--allowed-originscompletes GitHub login, gets consent first, and redeems the code. That run also found that the login page is actually served at/app/, which every unit test had missed.Your two side notes: you also mentioned that origin matching ignores the scheme and is case-sensitive on the host. Those weren't part of this change. If they matter to you, please open a separate issue so they get looked at properly.
Thanks again! 🙏