Unable to get Google Login to Work for authentication

I have been trying really hard to implement google sign up and sign in on the website I am creating.

Signup and login with email and password is working, and sign up with Google from local host seems to be working too.

But when I open cloudworkstation.dev and view the app in separate window , I am unable to sign up and even if the process goes through, the user is not been added in the firebase authentication.

I have added the correct domain as well

I want to understand whether publishing whether publishing and hosting the website with firebase can help solve the issue

I have checked the web console too and usually the error I get is

“Popup closed by the user”

2 Likes

Same problem here! I’ve tried everything to debug it. No solution helps

1 Like

I can help. I need screenshots or a list of the errors, problems, or pain points to do so

This is one of the most common (and frustrating!) hurdles with Google Auth, and you are on the right track.

That Popup closed by the user error is almost always misleading. It doesn’t mean the user closed the window; it’s a generic error that typically means there’s a domain authorization mismatch.

To answer your main question directly: Yes, publishing your website to Firebase Hosting will almost certainly solve this issue.

Here’s a breakdown of what’s happening and how to fix it, both for development and for production.


:rocket: The Quick Fix: Deploy to Firebase Hosting

When you deploy your site to Firebase Hosting, it runs on a domain like your-project-name.web.app. Firebase automatically adds this domain to all the necessary allowlists for you.

Since your localhost (which is also authorized by default) works, and the only thing that’s failing is the custom cloudworkstation.dev domain, this confirms it’s an authorization problem. Deploying to Firebase Hosting is the simplest way to get it working on a live URL.


:thinking: Why It’s Failing on cloudworkstation.dev

The Google Sign-In popup flow is more complex than it looks. It’s not just two windows; it’s three.

  1. Your App (cloudworkstation.dev) opens the popup.

  2. Google (accounts.google.com) handles the sign-in.

  3. Firebase Auth (a hidden helper page like my-project.firebaseapp.com) receives the token from Google and securely passes it back to your app.

For this to work, every domain involved must be authorized. You’ve likely done Step 1 but are missing Step 2.


:hammer_and_wrench: How to Fix It for cloudworkstation.dev

If you want to get this working on your .dev URL without deploying, you need to add your domain to two different places.

1. Firebase Console (You’ve likely done this)

This step allows your app to talk to Firebase.

  • Go to Firebase Console > Authentication > Settings > Authorized Domains.

  • Click Add domain and enter your cloudworkstation.dev URL (e.g., my-app-123.cloudworkstation.dev).

2. Google Cloud Console (The part everyone misses)

This step allows Google to trust your app.

  • Go to the Google Cloud Console: https://console.cloud.google.com/

  • Make sure you have the same project selected (it should have the same name as your Firebase project).

  • In the search bar or side menu, go to APIs & Services > Credentials.

  • Find your “OAuth 2.0 Client ID” that is used for your web app (it will say Web client). Click the pencil icon to edit it.

  • You will see two lists:

    • Authorized JavaScript origins: Click ADD URI and add your full cloudworkstation.dev URL (e.g., https://my-app-123.cloudworkstation.dev).

    • Authorized redirect URIs: Click ADD URI and add your project’s special auth handler URL. You can find this in the Firebase console (under Authorized Domains) or build it yourself. It looks like this:

      https://YOUR-PROJECT-ID.firebaseapp.com/__/auth/handler

After saving these changes, wait about 2-5 minutes for them to take effect, then clear your cache and try again.