How to change the app name for firebase authentication (what the user sees)

I asked Firebase support and got the following reply. Items in italics are my additions.

In order to update firebase-project-id.firebaseapp.com in the OAuth consent screen, you need a custom domain with Firebase Hosting (Firebase Console > Hosting > Connect Domain). This is because https://firebase-project-id.firebaseapp.com/__/auth/handler is hosted by Firebase Hosting. You need to point your custom domain to firebase-project-id.firebaseapp.com.

When connecting the custom domain, if you are not hosting your app on Firebase, use a new subdomain (e.g. app.yourdomain.example) and do not redirect it. Firebase will prompt you to add an entry on your DNS server and take care of the SSL certificate automatically.

After connecting your custom domain to your Firebase project, you should also follow the steps below:

  1. Go to the Firebase Console > Select Project > Authentication > Sign-in method > Facebook > Copy the URL under 'To complete setup, add this OAuth redirect URI to your Facebook app configuration.'
  • It will look something like https://firebase-project-id.firebaseapp.com/__/auth/handler
  1. Replace the project ID with your custom domain. It will look something like: https://yourdomain.example/__/auth/handler

  2. Go to the GCP Console > Select project > API Manager > Credentials > Add the link in #2 to the 'Authorized redirect URIs'

  3. Then ensure to use yourdomain.example as the authDomain in your app's configuration instead of firebase-project-id.firebaseapp.com

     firebase.initializeApp({
         apiKey: ....,
         authDomain: 'yourdomain.example',
          ...
     });
    

In my case, yourdomain.example is where I host my site, so I used app.yourdomain.example where I needed it.

  • Firebase Hosting URL
  • handler URL: https://app.yourdomain.example/__/auth/handler
  • GCP Credentials
    • Choose the right one under OAuth 2.0 client IDs. The client ID will match the one you have configured Firebase with in your code.
  • authDomain: "app.yourdomain.example"

For my case on web app with email sign in i just need to go into project settings on console, under general tab change Public-facing name and the %APP_NAME% in email got changed


This is what worked for me:

  1. Change the Firebase configuration you set in your code to have authDomain: "insertyourdomainnamehere.example"
  2. Press on the "Sign In With Google" on your app and see the error you get due to this change. Follow directions of the error.

The error lead me to https://console.cloud.google.com/apis/credentials (Google Cloud Platform > APIs & Services > Credentials).

  1. On that page, look at "OAuth 2.0 Client IDs" section.
  2. For me, there is only one record "Web client (auto created by Google Service)." Click the edit button on it.
  3. Look for "Authorized redirect URIs" section. In that section, add: https://insertyourdomainnamehere.example/__/auth/handler.

Then it should work! It should now say "Sign in to continue to yourdomain.example."