DEV Community

Cover image for Firebase Error: Unauthorized Domain in Deployed Site
Beatrice Egumandi
Beatrice Egumandi

Posted on

Firebase Error: Unauthorized Domain in Deployed Site

Hello Everyone! In this article we will be exploring the "FirebaseError: Firebase: auth/unauthorized-domain" error. We will be discussing what the error means, why it is displayed and how to resolve it.

What is Firebase?

Firebase is a popular backend platform used for developing web and mobile applications. It provides various features such as real-time database, authentication, hosting, and more. However, sometimes users may encounter errors during deployment, and one of the common errors is "auth/unauthorized Domain." This error occurs when the domain used for hosting the website is not authorized in the Firebase console.

Error message

Here's how you can resolve this issue:

  1. Go to the Firebase Console and select your project.
  2. Navigate to the Build section and click on the "Authentication" menu.
  3. Go to the "Settings" bar and click on "Authorized domains" and add your domain link using the "Add domain" button.
  4. Once the domain has been verified, refresh the website again.

Solution Image

You might have been wondering why your firebase authentication is working perfectly on your local host but not on your deployed site and this is because by default, Firebase allows access to your website through the local host (i.e. localhost:3000), which makes it convenient for development and testing purposes.

localhost whitelisted

In summary, when you want to deploy your website to a custom domain, you need to add that domain to the list of authorized domains in the Firebase Console. By white-listing your custom domain, you can ensure that your website is accessible only through authorized domains and improve the security of your data.

Thank you for reading this article!

Top comments (1)

Collapse
 
ismailpe profile image
Ismail PE • Edited

if you cannot add manually, try this automated way. dev.to/ismailpe/whitelist-new-doma...