Hi All
I’m building an app with AI studio. I’m trying to leverage firebase authentication but during preview I keep getting “Firebase: Error (auth/unauthorized-domain)” error. I’ve added multiple domain in authorised domain list but still the error persists. Any idea how to solve this?
Authorized domains:
“google_com”, “aistudio_google_com”,“googleusercontent_com”
xxx.scf_usercontent_goog
Using underscore to bypass 2 link rule of the forum.
hi @Parag_Patil ,
You are seeing the “auth/unauthorized-domain” error because your AI Studio app’s domain is not correctly added to Firebase’s Authorized Domains list. Go to your Firebase Console → Authentication → Settings → add the exact full domain shown in the error. Firebase Auth Domain Docs
Thanks!
Did you find a solution? The given answer here is not satisfactory. I have tried debugging and identified the domain used by the app run inside ai studio, but it wont work.
I’m having the same problem. It worked after deploying to Cloud Run and registering the domain with Firebase. But I don’t know what to do inside of AI Studio.
Google AI Studio support is directing us to Firebase support, while Firebase support is telling us to contact Google AI Support, creating a bit of a loop.
I reached out to Firebase Support and received a general response, but nothing concrete on how to add Firebase authentication within apps in the Google AI Studio environment. I think we also need help from the Google AI Studio support team on this, as Firebase support hasn’t provided enough detail to resolve our questions about Firebase authentication and Firestore integration.
I had the same issue, and the fix for me was to capture the exact window.location.origin and add that full URL to the Authorized Domains list in Firebase Console.
Here’s the snippet I used:
// Capture the full origin to ensure accuracy
const origin = window.location.origin;
const host = window.location.host;
// We usually display the host, but keeping the origin helps show full context
setCurrentUrl(host || origin || "Unable to detect URL");
Once I identified the correct origin and added it to Firebase, the auth/unauthorized-domain error disappeared.
Thanks for the tip; it gives me hope for a solution. Unfortunately, I’m very new to Firebase integration, so I don’t quite understand yet what you mean. Could you explain it in simple, beginner-friendly terms?
Basically, it’s important to understand that Google AI Studio is just a preview and essentially only handles the front end. As soon as you want to do anything with authentication or verification, it won’t work with AI prompts out of the box.
Furthermore, you don’t have direct access to important files within AI Studio, so I imagine it’s not possible to display such things in the web preview. Perhaps the AI adjusts it from time to time so that it works for some, but perhaps it doesn’t always do that; in any case, it’s not designed for that at all, and it’s a gamble whether it works or not, simply because you don’t have direct access.
For those less familiar with this, it might be helpful to download the app within Google AI Studio and import it into Firebase Studio where you have access to all files and continue development there. The AI in Firebase handles automatic integration about 70% of the time, but yes, it doesn’t always work perfectly. In those cases you need to define and configure it manually. However, there’s excellent documentation for this in Firebase.
I don’t think that will happen. AI Studio was and is only for playing around with AI for devs, not really for productive projects. But yes, I have used it also for productive projects, as I feel I can get usable one-shots for small things right away. Google has integrated it too well ;D
But if you really want to work with AI, and your own project is growing, I would recommend getting to other platforms like Firebase Studio as quickly as possible and getting used to them. AI Studio will probably always be a small testing ground that will gradually be reduced, and you have little safety there, as they can remove or add something at any time that could make your old apps unusable. Firebase Studio will be more stable for longer and uses an absolute standard in its core with VS Code which is then much easier for scaling, since you are then platform-independent.
It depends on whether Google Marketing sees new incremental opportunities in reaching markets with “easy-to-use” coding tools like Google AI Studio, compared to more complex pro tools.
There’s a huge untapped market, IMHO, for in-house vibe coding at businesses of all sizes, often requiring multi-user features like saving individual preferences or data. Adding that to an affordable, low-effort, AI-assisted, coding tool could open the door for Google to reach this audience.
Even professional developers could benefit, especially for rapid prototyping.
Perhaps Firebase Studio is such a product. Google AI Studio surely is, or could be.
UPDATE 2025-11-30: I can now successfully add Firebase Authentication using the email/password sign-in method to any app I build in Google AI Studio. It’s not exactly rocket science, but it does involve several steps and required thoroughly studying the documentation. The apps are deployed using Google AI Studio’s built-in Cloud Run service, so there was no need to set up any backend, aside from Firebase, of course.
Can you point me to what documentation you worked through? Or even copy the steps you did to get past this? This is driving me crazy, i don’t get why this of all things, is the hardest part to accomplish!