I have Wordpress click-to-deploy on the subdomain www.mydomain.com
, in a VM on Google Cloud Platform with the account account_1@gmail.com.
Also, I have a web app on Firebase Hosting on subdomain app.mydomain.com
, with account account_2@gmail.com.
The user logs into Wordpress, the PHP backend creates the user in Firebase Auth via POST API Rest, receives the response, and allows or disallows access to the application.
To prevent malicious use of the Firebase API (which is visible in the app) I enabled HTTP restrictions.
In these restrictions I put:
- the domains of my application (
*.mydomain.com/*
and mydomain.com/*
).
- the firebase functions domain (
*.firebaseapp.com/*
and firebaseapp.com/*
).
- the google analytics domain (
*.googleapis.com/*
and googleapis.com/*
).
I thought it would be enough but Wordpress stopped being able to send information.
SOLUTION:
I used 'ping' in the linux terminal, pointing to my Wordpress site (ping www.mydomain.com
) and got the following:
64 bytes from xx.yy.zzz.aa.bc.googleusercontent.com (xx.yy.zzz.aa): icmp_seq=70 ttl=56 time=199 ms
I copied the root domain (googleusercontent.com
) and added it in the API restrictions and voila, it worked.
(Sorry if my English has mistakes).