I have this web app project which I deploy on a google cloud appengine.
gcloud app deploy
The appengine is basically just a webserver serving static files. But I had to use the appengine for prerendring the website for SEO.
In the webapp, I use the firebase authentication API. https://www.gstatic.com/firebasejs/7.8.0/firebase-auth.js
In firebase console, I activated the anonymous authentication. preview of firebase auth providers
When I deploy a new version of my static content on the appengine, I create a new version named "stag" only to preview and test everything before deploying to production. I can then preview my work on the version specific url which is something like this:
https://stag-dot-frb-proj1.appspot.com/
frb-proj1: is my firebase project id.
When I preview my work on the url: https://stag-dot-frb-proj1.appspot.com/ I got the following error:
{
"error": {
"code": 403,
"message": "Requests from referer https://stag-dot-frb-proj1.appspot.com/ are blocked.",
"errors": [
{
"message": "Requests from referer https://stag-dot-frb-proj1.appspot.com/ are blocked.",
"domain": "global",
"reason": "forbidden"
}
],
"status": "PERMISSION_DENIED"
}
}
I spotted the error in the chrome dev tools on the network tab. It happens when the app tries to access the following url:
https://www.googleapis.com/identitytoolkit/v3/relyingparty/signupNewUser?key=AIza....CcpT0
I assume this api call if for creating a new anonymous user on the firebase auth api.
All the used domains are authorized in the firebase console as expected.
Authorized DOMAINS
- frb-proj1.firebaseapp.com
- frb-proj1.web.app
- stag-dot-frb-proj1.appspot.com
- frb-proj1.appspot.com
Tried solution
I tried to follow this example https://cloud.google.com/appengine/docs/standard/python/authenticating-users-firebase-appengine
And setup the environment variable FIREBASE_PROJECT_ID in my app.yaml for the appengine
QUESTION
Any idea what is wrong ?