firebase-admin-node icon indicating copy to clipboard operation
firebase-admin-node copied to clipboard

[FR] Setting quota project/x-goog-user-project

Open flagbug opened this issue 3 years ago • 2 comments

Is your feature request related to a problem? Please describe.

I have two projects in Google Cloud: project-a, which hosts Firebase stuff such as user authentication, and project-b, which contains a Node application that needs to have access to the Firebase API for e.g user administrative tasks in project-a. I've create a service account (let's call it service-b-sa in project-b and assigned service-b-sa the Firebase Admin role in project-a.

The problem now is that the requests that the Firebase Admin Node library sends fail with:

FirebaseAuthError: //cloud.google.com/docs/authentication/. 
If you are getting this error with curl or similar tools, you may need to specify 'X-Goog-User-Project' HTTP header for quota and billing purposes. 
For more information regarding 'X-Goog-User-Project' header, please check https://cloud.google.com/apis/docs/system-parameters.`

Other libraries, such as e.g the .NET library that we're using elsewhere for the same purposes let me set the quota/billing/user project directly, as an example for .NET, it would be GoogleCredential.GetApplicationDefault().CreateWithQuotaProject("project-a")

Describe the solution you'd like

A way to easily set the quota/billing/user project

Describe alternatives you've considered

I'm currently looking into intercepting the Node HTTP requests and attaching the header by force

flagbug avatar Aug 04 '22 10:08 flagbug

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

google-oss-bot avatar Aug 04 '22 10:08 google-oss-bot