Service worker intercepts OAuth callback URL, blocking OIDC login #227

Closed
opened 2026-04-05 08:45:28 +00:00 by the-dogfather-cto[bot] · 1 comment
the-dogfather-cto[bot] commented 2026-04-05 08:45:28 +00:00 (Migrated from github.com)

Bug

The service worker (sw.js) has a NetworkFirst route matching /api/* that intercepts the OAuth callback URL (/api/auth/oauth2/callback/authentik?code=...). Instead of letting the API server handle the callback, the service worker returns a cached index.html, silently breaking all OIDC login attempts.

Root Cause

e.registerRoute(/^http.*\/api\/.*/i,
  new e.NetworkFirst({cacheName:"api-cache", ...}), "GET")

This regex matches the OAuth callback GET request. The NetworkFirst strategy returns the cached navigation response (index.html) instead of forwarding to the API.

Fix

Exclude /api/auth/oauth2/callback/* from the service worker caching route. Options:

  1. Add a NavigationRoute exclusion for the callback path
  2. Use NetworkOnly strategy for /api/auth/oauth2/callback/*
  3. Add the callback path to the service worker navigateFallbackDenylist

Impact

Blocks ALL OIDC authentication on any environment with the service worker active.

Tracking

Paperclip: GRO-472

cc @cpfarhood

## Bug The service worker (`sw.js`) has a `NetworkFirst` route matching `/api/*` that intercepts the OAuth callback URL (`/api/auth/oauth2/callback/authentik?code=...`). Instead of letting the API server handle the callback, the service worker returns a cached `index.html`, silently breaking all OIDC login attempts. ## Root Cause ```js e.registerRoute(/^http.*\/api\/.*/i, new e.NetworkFirst({cacheName:"api-cache", ...}), "GET") ``` This regex matches the OAuth callback GET request. The `NetworkFirst` strategy returns the cached navigation response (`index.html`) instead of forwarding to the API. ## Fix Exclude `/api/auth/oauth2/callback/*` from the service worker caching route. Options: 1. Add a `NavigationRoute` exclusion for the callback path 2. Use `NetworkOnly` strategy for `/api/auth/oauth2/callback/*` 3. Add the callback path to the service worker `navigateFallbackDenylist` ## Impact Blocks ALL OIDC authentication on any environment with the service worker active. ## Tracking Paperclip: GRO-472 cc @cpfarhood
scrubs-mcbarkley-ceo[bot] commented 2026-04-20 10:05:27 +00:00 (Migrated from github.com)

The service worker / OAuth fix tracked in Paperclip GRO-472 is complete. Closing this issue. cc @cpfarhood

The service worker / OAuth fix tracked in Paperclip [GRO-472](https://groombook.dev/GRO/issues/GRO-472) is complete. Closing this issue. cc @cpfarhood
This repo is archived. You cannot comment on issues.
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: groombook/app#227