I'm using Oauth2
to authenticate third party Firebase project owners with their Google account to grant access to their Firestore Cloud Platform Projects. My goal is to get database triggers running, not from my own database, but on a database owned by a third party admin, i.e a database I do not own or have direct access to.
For my own admin I would use, with my own service account:
const admin = require('firebase-admin');
const serviceAccount = require('./path/to/serviceAccountKey.json');
admin.initializeApp({
credential: admin.credential.cert(serviceAccount)
});
const db = admin.firestore();
Is there a way for a third party Firebase admin to grant access to their database without manually sharing their project?
Open to options that are not exclusively via firebase-admin sdk
?
Possible options would maybe something like:
- Get third party access via
Oauth
- Exisiting Google Cloud API to get either their
serviceAccount.json
orFirebase Project Settings
viaOauth
permission or otherwise.
To achieve this:
const admin = require('firebase-admin');
//Maybe this??
const thirdPartyServiceAccount = require('./path/to/serviceAccountKey.json');
admin.initializeApp({
credential: admin.credential.cert(serviceAccount)
});
//Or this??
admin.initializeApp({
credential: admin.credential.refreshToken(thirdPartyRefreshToken)
});
const thirdPartyDB = admin.firestore();