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!
1 Like
I have exactly the same issue .
Auth Emulator will redirects to : https://ssh.cloud.google.com/devshell/gateway/oauth?***
where we receive CORS Error
Hi guys, I have the same issue.
My app is running on the port 9000, so the URL is https://9000-${PUBLIC_WEB_HOST}
, but the emulator runs in another port connectAuthEmulator(auth, 'https://9099-${PUBLIC_WEB_HOST}', { disableWarnings: true })
, so when I try to login the popup is opened and I am able to Auto-generate user information
, but when I click on Sign in with Google.com
I get this error (replacing some values for readability):
Error: Auth Emulator Internal Error: No matching frame
at assert (https://9099-${PUBLIC_WEB_HOST}/emulator/auth/handler?apiKey=[apiKey]&appName=[appName]&authType=signInViaPopup&redirectUrl=https%3A%2F%2F9000-${PUBLIC_WEB_HOST}%2Flogin&v=11.0.2&eventId=9557541183&providerId=google.com&scopes=profile:285:15)
at https://9099-${PUBLIC_WEB_HOST}/emulator/auth/handler?apiKey=[apiKey]&appName=[appName]&authType=signInViaPopup&redirectUrl=https%3A%2F%2F9000-${PUBLIC_WEB_HOST}%2Flogin&v=11.0.2&eventId=9557541183&providerId=google.com&scopes=profile:333:7
at sendAuthEventViaIframeRelay (https://9099-${PUBLIC_WEB_HOST}/emulator/auth/handler?apiKey=[apiKey]&appName=[appName]&authType=signInViaPopup&redirectUrl=https%3A%2F%2F9000-${PUBLIC_WEB_HOST}%2Flogin&v=11.0.2&eventId=9557541183&providerId=google.com&scopes=profile:377:12)
at saveAuthEvent (https://9099-${PUBLIC_WEB_HOST}/emulator/auth/handler?apiKey=[apiKey]&appName=[appName]&authType=signInViaPopup&redirectUrl=https%3A%2F%2F9000-${PUBLIC_WEB_HOST}%2Flogin&v=11.0.2&eventId=9557541183&providerId=google.com&scopes=profile:332:5)
at finishWithUser (https://9099-${PUBLIC_WEB_HOST}/emulator/auth/handler?apiKey=[apiKey]&appName=[appName]&authType=signInViaPopup&redirectUrl=https%3A%2F%2F9000-${PUBLIC_WEB_HOST}%2Flogin&v=11.0.2&eventId=9557541183&providerId=google.com&scopes=profile:466:3)
at HTMLFormElement.<anonymous> (https://9099-${PUBLIC_WEB_HOST}/emulator/auth/handler?apiKey=[apiKey]&appName=[appName]&authType=signInViaPopup&redirectUrl=https%3A%2F%2F9000-${PUBLIC_WEB_HOST}%2Flogin&v=11.0.2&eventId=9557541183&providerId=google.com&scopes=profile:514:5)
Did you find any way to overcome this bug?