DEV Community

SWAPNIL AHMMED SHISHIR
SWAPNIL AHMMED SHISHIR

Posted on

Firebase Google Login Error: auth/unauthorized-domain – Step-by-Step Fix

βœ… How to Fix auth/unauthorized-domain for Google Login in Firebase

πŸ”§ Step-by-Step:

🟒 1. Go to Firebase Console

Visit: https://console.firebase.google.com/

  1. Select your project
  2. Go to Authentication (from the left sidebar)
  3. Click on the "Sign-in method" tab

🟒 2. Enable Google Sign-In (if not already)

  • In the Sign-in providers list, click Google
  • Make sure it's Enabled
  • Set your project’s public-facing name
  • Click Save

🟒 3. Add Authorized Domains

Still under Authentication > Sign-in method, scroll to the "Authorized domains" section.

Click "Add domain", and add the domain where your app is running, for example:

admin.ts-geosystems.com.bd
Enter fullscreen mode Exit fullscreen mode

Also add:

localhost
Enter fullscreen mode Exit fullscreen mode

(if you're testing locally)

βœ… Make sure it includes the exact domain/subdomain you're using in your frontend (without https:// or slashes).

🟒 4. Save and Retry

After adding the correct domains:

  • Clear your browser cache (optional but helps)
  • Restart your frontend app
  • Try logging in with Google again

πŸ›‘οΈ Optional Security Tip

If you're deploying to multiple environments (dev, staging, production), make sure all domains are whitelisted in Firebase under Authorized domains.

Top comments (0)