Skip to content

Fix Google Sign-In broken by Service Worker intercepting auth handler#67

Merged
quequeo merged 1 commit intomainfrom
feature/fix-google-login-sw-auth
Mar 19, 2026
Merged

Fix Google Sign-In broken by Service Worker intercepting auth handler#67
quequeo merged 1 commit intomainfrom
feature/fix-google-login-sw-auth

Conversation

@quequeo
Copy link
Owner

@quequeo quequeo commented Mar 19, 2026

Summary

  • Fix root cause: Workbox Service Worker navigateFallback was intercepting Firebase reserved /__/auth/handler routes, redirecting them to index.html instead of letting Firebase handle OAuth
  • Add navigateFallbackDenylist: [/^\/__\//] to vite.config.js to exclude /__/ paths from SW interception
  • Use signInWithPopup in development and signInWithRedirect in production for Google Sign-In
  • Default login tab is now "Acceder con Google" instead of "Email y contraseña"
  • Extract validateAndReject helper to reduce code duplication in AuthProvider

Test plan

  • ESLint: 0 errors
  • Prettier: all files pass
  • Vitest: 349/349 tests pass (49 test files)
  • Pre-push hooks pass
  • Local dev tested: Google Sign-In popup works correctly at localhost:5173
  • Production: verify /__/auth/handler no longer redirects to /login
  • Production: verify Google Sign-In redirect flow works at app.winbit.com.ar

…dler

The Workbox SW navigateFallback was catching Firebase reserved /__/ routes
and serving index.html instead, preventing the OAuth handler from working.

- Add navigateFallbackDenylist to exclude /__/ paths from SW interception
- Use signInWithPopup in dev, signInWithRedirect in prod
- Extract validateAndReject helper to reduce duplication
- Default login tab to Google instead of email/password
- Update tests to cover redirect result handling
@quequeo quequeo merged commit 2cee7f0 into main Mar 19, 2026
2 checks passed
@quequeo quequeo deleted the feature/fix-google-login-sw-auth branch March 19, 2026 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant