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?
Make sure you've got the API keys set correctly in your Google Developer Console for your Firebase project. Show activity on this post. There are two different configurations for release mode and test mode. make sure that you use the API key which is related to each.
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.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With