Goal:
This Firebase Cloud Function should use Cloud APIs with domain-wide delegation so any user can update some G Suite Admin Panel user information when the Firebase DB changes.
Question:
Which package's method should I use to gain domian-wide delegation for my app.
- firebase:
firebase.auth.GoogleAuthProvider()
- googleapis:
google.auth.OAuth2
- google-auth-library:
new GoogleAuth()
Details:
I'm not connecting the dots regarding the Google Identity Platform, and I am stuck here at this step. How does a firebase-hosted nodejs app put together a web and access token for Google API requests?
Firebase projects use Google Cloud Platform projects, so
I have...
- Added to the project a
service account actor
via API/Credentials in the GCP-Console - Checked the Enable G Suite Domain-wide Delegation box
- Stored the private_key.JSON.
- Authorized API Clients (in the G Suite Admin Panel) with the Service Account Client ID
Should I Use...
Firebase: Maybe look into the whitelisting area of Google OAuth2 settings, and/or work with the services.json I got from firebase.
Google API via googleapis: Even though I'm using firebase.auth.GoogleAuthProvider()
to validate the user, maybe use google.auth.OAuth2
to get domain-wide delegation from GCP (like app or compute engine)
Google Auth via google-auth-library: Again, even though I'm using firebase.auth.GoogleAuthProvider()
to validate the user, maybe use new GoogleAuth()
to get domain-wide delegation from GCP (like app or compute engine)
Updates
I've learned:
- Google's npm package
googleapis
is not for clients (browsers). I'm now trying to using it in Firebase Cloud Functions