I have three projects under my organization on GCP (dev, staging, prod). The IAM settings are shared/set on the organizational level.
On each project I have made a Cloud Run app with the GCP example container "hello". Keep in mind that all of these setups are identical.
- I create the Cloud Run app
- I create a load balancer with all the configurations
- I connect a subdomain to the load balancer IP (different IP for each project).
- I setup OAuth Consent screen and IAP
- I add the relevant user (also the owner) as IAP-secured Web App User for the IAP for the service.
Worth mentioning: I have one domain, and have made three subdomains under it. dev.domain.com etc... I set the DNS settings accordingly to the load balancer.
The result is that one of these projects works with signing in and accessing the app. The other ones are forbidden with the detailed response: "The request was not authenticated. Either allow unauthenticated invocations or set the proper Authorization header"
Yet another "check": If the Run app authentication settings is set to "allow unauthenticated invocations" all of them work. With "Require authentication" (IAP used) only one works.
So the question is: What can interfere/cause so that only one project can authenticate to the service while the other ones cant. Could it have something with the domain to do?
I have tried deleting one of the projects (that was not working) and remaking it again from scratch with the same results.
I bought a new domain and tried to connect that to one of the load balancers instead. But that didn't make a difference.