Skip to content

fix(pwa): stop the service worker swallowing Authentik OAuth redirects (Google sign-in flicker) - #316

Merged
izzywdev merged 1 commit into
masterfrom
claude/fix-sw-authentik-paths
Jul 20, 2026
Merged

fix(pwa): stop the service worker swallowing Authentik OAuth redirects (Google sign-in flicker)#316
izzywdev merged 1 commit into
masterfrom
claude/fix-sw-authentik-paths

Conversation

@izzywdev

Copy link
Copy Markdown
Owner

Diagnosed live with the product owner: Sign in with Google flickered back to the login page.

Root cause

The PWA service worker's navigateFallbackDenylist only excluded /api/*. A full-page navigation to /source/oauth/login/google/ (the app-Ingress-proxied Authentik source-launch) was intercepted by the SW and served the cached SPA shell instead of reaching Authentik. The app re-booted at that URL, found no token, and showed the login page again — the "flicker." curl worked (no SW); the browser did not.

The app Ingress reverse-proxies Authentik's native paths (/source, /application, /if, /outpost.goauthentik.io, /-) to the IdP. When those became app-hosted, this denylist was never updated to match — two lists that must agree, nothing checking them.

Fix

Add the Authentik path families to navigateFallbackDenylist. Verified the regexes deny /source/oauth/login/google/ and /api/*, and do not deny app routes like /dashboard.

Scope / honesty

This fixes Google sign-in. Password login has a separate server-side cause — Authentik is responding very slowly in prod (measured 6.5s for OIDC discovery, 20s+ for the password flow), so the security service's server-side flow executor times out and reports "invalid credentials." That is not fixed here and is tracked separately (needs Authentik pod/DB health — cluster access).

Deploys the frontend on merge to master.

Refs #294

🤖 Generated with Claude Code

…s (Google sign-in flicker)

"Sign in with Google" just flickered back to the login page. Root cause: the PWA
service worker's navigateFallbackDenylist only excluded /api/*, so a full-page
navigation to /source/oauth/login/google/ (the app-Ingress-proxied Authentik
source-launch) was intercepted by the SW and served the cached SPA shell instead
of reaching Authentik → the browser re-booted the app at that URL, found no token,
and showed the login page again. curl worked (no SW); the browser didn't (SW).

The app Ingress reverse-proxies Authentik's NATIVE paths (/source, /application,
/if, /outpost.goauthentik.io, /-) to the IdP (see values-prod authentik.oidc).
When those moved app-hosted, this denylist was never updated to match — two lists
that must agree, with nothing checking them. Add the Authentik path families to
the denylist so social sign-in navigations reach the server. Verified the regexes
deny /source/oauth/login/google/ and /api/*, and do NOT deny app routes.

NOTE: this fixes Google. Password login has a SEPARATE server-side cause
(Authentik responding very slowly → the flow executor times out → "invalid
credentials"); tracked separately.

Refs #294

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session-Id: f636c22e-1cd7-401e-8843-97e3e3a4ba01
@izzywdev izzywdev added the auto-merge Enable squash auto-merge once CI passes label Jul 20, 2026
@github-actions
github-actions Bot enabled auto-merge (squash) July 20, 2026 15:11
@github-actions

Copy link
Copy Markdown
Contributor

Automated code review (gate-code-review)

Credit balance is too low

Report-only — this check never blocks merge.

@izzywdev
izzywdev merged commit 5487d0a into master Jul 20, 2026
48 of 50 checks passed
@izzywdev
izzywdev deleted the claude/fix-sw-authentik-paths branch July 20, 2026 15:24
izzywdev added a commit that referenced this pull request Jul 20, 2026
release.yml built the image (build-and-push succeeded) but deploy-application was
SKIPPED because deploy-infrastructure (a stale AWS website Terraform reading a
non-existent ELB/ASG) failed and gates it. So the #316 service-worker fix never
reached prod. Bump the frontend tag here so Argo (auto-sync on) reconciles it —
the same tag bump the skipped job would have done. Frontend-only; other services
unchanged. The stale deploy-infrastructure gate is a separate release-pipeline bug
to fix so app deploys stop depending on a dead AWS step.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session-Id: f636c22e-1cd7-401e-8843-97e3e3a4ba01
@izzywdev
izzywdev restored the claude/fix-sw-authentik-paths branch July 27, 2026 11:43
@izzywdev
izzywdev deleted the claude/fix-sw-authentik-paths branch July 27, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge Enable squash auto-merge once CI passes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant