66

I am trying to run this sample firebase project, but I keep getting this error in the browser console.

Lf {code: "auth/unauthorized-domain", message: "This domain (mail-demo-fcm.firebaseapp.com) is not…se console -> Auth section -> Sign in method tab."}

code: "auth/unauthorized-domain"

message: "This domain (mail-demo-fcm.firebaseapp.com) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab."

I have enabled Google in Authentication -> Sign-in Method as sign-in providers.

enter image description here

Am I missing something ?

A little guide will be helpful.

And I am using Firebase's free plan.

1
  • 1
    Also don`t use IP addresses as URL here. Instead of 127.0.0.1, use localhost.
    – Aman Jain
    Jun 30, 2021 at 9:38

9 Answers 9

155

You need to add domain mail-demo-fcm.firebaseapp.com to Authentication menu in Firebase at Authorized domains

enter image description here

4
  • 3
    There's no "Authorized domains" section. It jumps straight to "Advanced"
    – pete
    Aug 9, 2022 at 5:15
  • 2
    Go to Authorization > Settings (top tab) > Domains (left-hand-side and below) > Authorized Domains
    – sciffany
    Aug 10, 2022 at 11:04
  • I am trying to add this with vite react app and url generated for localhost is 127.0.0.1:5173 but it is not allowed to be added in whitelisting of firebase. Could u suggest please? Feb 15, 2023 at 11:41
  • 1
    @Clinto_92_Abraham I used my IP address without the port number and it worked fine. In your case you'd need to only put 127.0.0.1
    – Moody
    Jun 28, 2023 at 21:13
12

The authorized domains section might also be in the settings page. Here is a screenshot: Screenshot of firebase authorized domains

1
  • I had a problem adding sub domain to the "Authorized Domains". Finally it worked by adding the main domain to "Authorized Domains" Nov 23, 2023 at 8:28
11

If localhost is already in the list of domains, make sure you're accessing your test app via http://localhost/ and not http://127.0.0.1/

3
  • 1
    This was a lifesaver !
    – bhavesh
    Feb 7, 2023 at 2:11
  • 1
    Wohh, I was struggling to figure this out. Thanks you saved a ton of headache! Apr 24, 2023 at 4:54
  • what do you mean by list of domains? Sep 20, 2023 at 19:36
7

Below the sign-in method section, there is a Authorized domains section. I think you need to whitelist your domain there.

1
3
  1. Open Firebase
  2. Go to console
  3. Open your project
  4. Go to Authentication
  5. sign-in-method
  6. Add domain

Try it!

In my case it's working

1

Enable localhost and your own domain that you are using in the firebase console.

  1. Login into firebase
  2. Click on the authentication tab
  3. Add authorized domains
0

The solution from @alkas was helpful, but I also needed to explicitly enable the Sign-in providers for my app (Email/Password, Google, etc) for this error to go away

0

In my case, I found the problem after deleting localhost from my "Authorized domains".

So I just add it (localhost), so everything is okay !

-localhost, because I'm on local,

-project_name.firebase.com and project_name.web.app when app deployed. Thanks !

0

In my case, I use two environments for development and testing. By mistake, I deployed the build to the testing environment, which was created using the development configuration parameters.

Not the answer you're looking for? Browse other questions tagged or ask your own question.