Firebase Auth Emulator

I’m wondering if anyone has managed to get the Firebase Auth Emulator running successfully and connecting to a frontend in IDX? I can confirm that the emulator has started up and is running automatically from the firebase.json configuration, but when trying to run the signInAnonymously function, the request fails due to CORS problems with an OAuth redirect network call. I am confident this is IDX related because if I forgo the emulator, it has no problems functioning properly.

I believe the problem is semi-related to this other CORS discussion for IDX but I am unlikely to be able to resolve the problem in the suggested way since I don’t control the emulators and enabling the connection to the emulators on the frontend is done through the Firebase library using connectAuthEmulator(auth, 'http://127.0.0.1:9909/');.

Any ideas? Is this an unavoidable bug due to the byproduct of the IDK authentication?

In either case IDX is amazing and I’m really enjoying the experience, keep up the awesome work!

I’ve been testing around with this myself and I got it mostly working. I’ll post a sample once I have it up and running. The key is to use the domain that IDX uses when configuring the emulator with connectAuthEmulator(auth, '<domain>');

Makes sense! When I try it, I still come up short from fully functioning, but I do see different results than CORS which is always encouraging in a way.

Using the domain that the preview is running on connectAuthEmulator(auth, 'https://9000-${PUBLIC_WEB_HOST}/', { disableWarnings: true }); (Ignore the public, that’s just so I can expose WEB_HOST to SvelteKit) doesn’t complain about CORS but does 404 on auth calls. I tried using different ports that IDX is telling me is running for emulators but still no dice and it goes back to CORS problems.

I look forward to the sample if you get the chance, I really appreciate the help and love the product and work you guys have done!