fix(authn): Google sign-in goes direct to Google + repair auth e2e drift from the Security API cutover - #277
Conversation
startSocialLogin sent the browser to the generic OIDC authorize endpoint, which requires an authenticated session. With none, Authentik fell back to the brand's authentication flow and rendered its own identification page (/if/flow/...) with a "Google" button — stranding the user on the IdP's UI instead of Google. Launch the Google source directly instead: /source/oauth/login/google/?next=<authorize>. The source-redirect view 302s straight to accounts.google.com; after the callback the source flow runs (silent enrollment first time, login when returning), then `next` resumes authorize, which issues the code silently. Same cookie/state/PKCE round-trip — one hop inserted ahead of authorize, so no /if/flow/ ever renders. This also lets devops drop /if from the IdP ingress. Also corrects the stale source-google.yaml comment (the removed auth.fuzefront.com -> app.fuzefront.com); the callback is host-derived, not a settable field. Co-Authored-By: Claude <claude-opus-4-8> <noreply@anthropic.com> Claude-Session-Id: cf830721-b1ef-4fe0-a024-035ad280dcf7
Automated code review (gate-code-review)
Report-only — this check never blocks merge. |
…ly uses
The security cutover moved the SPA onto /api/v1/security/* (POST /session to
log in, GET /methods for capabilities, /social/google/start, /session/exchange),
but the e2e suite still waited on /api/auth/login and mocked /api/auth/method.
The frontend never calls those anymore, so page.waitForResponse() hung until
timeout — this is why "E2E (sign-in)" has been red on master since the cutover.
The tests were asserting an endpoint we deleted from the client, not a real bug.
- auth-simple / clock-load / mobile-layout / pages/login-page: wait on
POST /api/v1/security/session. Match the METHOD too — GET /session ("me")
shares the URL and would otherwise satisfy the wait before login completes.
- google-signin: mock /api/v1/security/methods with the neutral descriptor
(`social: ['google']` replaces the vendor-flavoured `oidcConfigured`), and
route the real endpoints — /social/google/start and /session/exchange.
- federated-apps-register-activate: "me" is GET /api/v1/security/session.
- live-smoke (post-prod): smoke /methods and sign in via /session — the same
surface prod serves browsers, so it fails if real sign-in breaks.
Also ADDS the missing coverage of the new surface to oidc-plumbing (it only
tested the deprecated /api/auth shim): capability descriptor, password sign-in,
wrong-password 401, plus a boundary assertion that no response leaks the vendor.
The /api/auth shim assertions stay — it is still mounted for one release.
Co-Authored-By: Claude <claude-opus-4-8> <noreply@anthropic.com>
Claude-Session-Id: cf830721-b1ef-4fe0-a024-035ad280dcf7
Automated code review (gate-code-review)Credit balance is too low Report-only — this check never blocks merge. |
The source path was hardcoded to google. The `provider !== 'google'` guard above means nothing else can reach it today, so this is not a live bug — but it is a trap: widening that guard would silently route every new provider through Google's source. Track `provider` so the slug cannot drift from the guard. Co-Authored-By: Claude <claude-opus-4-8> <noreply@anthropic.com> Claude-Session-Id: cf830721-b1ef-4fe0-a024-035ad280dcf7
Automated code review (gate-code-review)Credit balance is too low Report-only — this check never blocks merge. |
|
Re: the gate-code-review note on One correction for the record: it wasn't a live break. (The second review comment reported only "Credit balance is too low" — no finding to address.) 🤖 Addressed by Claude Code |
|
gate-code-review reported only "Credit balance is too low" — the reviewer bot failed to run rather than raising a finding, so there is nothing to address from it. (Its earlier substantive note, the hardcoded google source slug, was fixed in The two red checks — Fix is in flight as separate PRs (add the security service to the compose stack + route it in nginx; then repoint the sign-in workflow). This PR stays red until that lands — deliberately not papering over it. 🤖 Addressed by Claude Code |
Two AuthN correctness fixes this session owns. Both stem from the Security API cutover.
1. Google sign-in got stuck on Authentik's UI
startSocialLogin302'd to the generic OIDC authorize endpoint. Authorize requires a session; with none, Authentik falls back to the brand's auth flow and renders its identification page (/if/flow/...) with a "Google" button — the IdP's own UI, leaking across our boundary.Fix: launch the Google source directly —
/source/oauth/login/google/?next=<authorize>. That view 302s straight toaccounts.google.com; after the callback the source flow runs (silent enrollment first time, login when returning), thennextresumes authorize, which issues the code silently. Same cookie/state/PKCE round-trip — one hop inserted ahead of authorize, so no/if/flow/ever renders. Adds a regression assertion that the redirect never matches/if/.This unblocks devops dropping
/iffrom the IdP ingress.2. The auth e2e suite was testing endpoints we deleted
E2E (sign-in)has been red on master since the cutover — not flake, and not something to wave off as "pre-existing". The SPA moved to/api/v1/security/*(POST /session,GET /methods,/social/google/start,/session/exchange) but the tests still waited on/api/auth/loginand mocked/api/auth/method. The frontend never calls those anymore, sowaitForResponsehung until timeout.Repointed:
auth-simple,clock-load,mobile-layout,pages/login-page,google-signin,federated-apps-register-activate, and the post-prodlive-smoke. Where login is awaited, the HTTP method is matched too —GET /session("me") shares the URL and would otherwise satisfy the wait before login completed.Also adds the coverage that was missing:
oidc-plumbingonly exercised the deprecated/api/authshim and had zero coverage of the surface the SPA and consumers actually use. It now asserts the capability descriptor, password sign-in, wrong-password 401, and a boundary check that no response leaksauthentik/permit. The shim assertions stay — it's still mounted for one release.Verification
CI is the gate (local install hangs on this Windows box). The proof is
E2E (sign-in)going green on this PR having been red on master.hold+ noauto-merge— master is deploy-on-push; merge in a deploy window. Does not touchpackage-lock.json.Co-Authored-By: Claude