10

I'm using Firebase Authentication for my web app, and customizing the redirect domain for Firebase Authentication's Google Sign-In feature so that Google's authentication page will show Continue to: mydomain.io,

I followed Firebase's documentation:

  1. Domain Hosting

Firebase Hosting

Cloudflare config

  1. Add auth.mydomain.io to the list of authorized domains in the Firebase console

Firebase console authorized domains

  1. In the Google OAuth setup page, whitelist the URL of the redirect page which is https://auth.mydomain.io/__/auth/handler

Google OAuth client

  1. Edit my app's JavaScript code:
const firebaseConfig = {
 ...
 authDomain: "auth.mydomain.io",
 ...
}

Running my app locally, I can see my domain is properly linked to my app.

Login: Continue to mydomain.io

But, when I select a Google account to connect to, nothing happens. In the popup, I am redirected to auth.mydomain.io with a blank page & an infinite loading bar at the top

EDIT: I also have the same problem using Facebook OAuth

After selecting the account

After maybe 10 seconds the popup closes by itself and I get the following error in my local app console:

FirebaseError: Firebase: Error (auth/popup-closed-by-user).
    at createErrorInternal (assert.ts:122:1)
    at _createError (assert.ts:83:1)
    at popup.ts:283:1

When I change the app's JavaScript configuration to myapp.firebaseapp.com for the authDomain property, it works fine and I can login with my google account

const firebaseConfig = {
 ...
 authDomain: "myApp.firebaseapp.com",
 ...
}
2
  • Open browser DevTools on the popup and look for errors. Commented Feb 7, 2022 at 21:07
  • I already did that but there is absolutely no log in the console. I put a breakpoint before closing the popup but no error is showing up in the console unfortunately Commented Feb 8, 2022 at 8:02

1 Answer 1

4

Coming back with some good news. It now works perfectly, though I haven't changed anything. Give it 24h-48h if you are in the same situation I was.

Sign up to request clarification or add additional context in comments.

2 Comments

I'm thinking it didn't work until the SSL cert for your custom domain was operative. I see when it instructs on setting up the A record it notes "Your site will show a security certificate warning for a few hours, until the certificate has been provisioned." Thanks for the guide!
Hey, one question... Did you need to upload some script to your auth.mydomain.io? Or do you need to configure the domain and it works magically?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.