Custom Firebase Authentication Handler

custom firebase authentication handler

By default Firebase uses the [app-name].firebaseapp.com as the URL for handling the authentication flow. But we can also use a custom URL for firebase authentication handler.

This can be overwritten by updating the authDomain in the firebase config.

const firebaseConfig = {
  apiKey: "...",
  // By default, authDomain is '[YOUR_APP].firebaseapp.com'.
  // You may replace it with a custom domain.
  authDomain: '[YOUR_CUSTOM_DOMAIN]',
  ...
};

Go to Google Cloud Console
Select the project
Use the menu to navigate to “APIs and Services”
Select “Credentials” sub menu
Or you can directly visit the page by clicking here, and change the selected project dropdown if required.
The page should have a section on OAuth 2.0 Client IDs

In the current case, select the “Web Client…”
It should have a section for Authorized redirect URLs, with the default authorization handler URL.


Click on “Add URL” and add your custom URL there.
Click Save

Wait for 5 minutes and test the Google login flow.

This is how one can use a custom URL for firebase authentication handler. You can read more on Firebase here.

Leave a Reply