Requests for referrer are blocked when trying to sign in anonymously to Firebase

12,075

Solution 1

It seems like you have set some referrer restrictions on your API key. You need to go to the Google Cloud Console and modify these restrictions on your API key.

Solution 2

This helped for me:

console cloud google -> APIs & services -> credentials -> click on: browser key (auto created by firebase) -> application restrictions: none & API restrictions: don't restrict key.

Now your API won't block any requests. I hope this works!

Share:
12,075

Related videos on Youtube

lyessmecano
Author by

lyessmecano

Updated on June 04, 2022

Comments

  • lyessmecano
    lyessmecano about 2 years

    I’m trying to sign in anonymously from a Web app using the JS SDK and it works great on some environments, but on one environment, the exact same code that’s working elsewhere is giving me a 403:

    (index):64 {“error”:{“code”:403,“message”:“Requests from referer https://myapp.firebaseapp.com/ are blocked.“,”errors”:[{“message”:“Requests from referer https://myapp.firebaseapp.com/ are blocked.“,”domain”:“global”,“reason”:“forbidden”}],“status”:“PERMISSION_DENIED”}}

    Yet I think I checked everything is the same in all environments: anonymous authentication is enabled and my web app is on Firebase Hosting so the code should be environment-independent.

    Any idea where else this could come from?

    • Akshay komarla
      Akshay komarla over 5 years
      were you able to find a solution?
    • Michale Rezene
      Michale Rezene over 3 years
      having the same problem can you provide me with your solution that work for you
  • lyessmecano
    lyessmecano over 5 years
    Which API key? Because I checked that already, and the referrer restrictions seem to be consistent with other environments.
  • Dpedrinha
    Dpedrinha about 2 years
    Works, but unsafe. You need to add the Authorized domains (from Firebase console) there and it should work.