I am using google identity provider to sign into firebase projects. Now I would like to use one identity provider project to sign into multiple cloud firestores. Mainly I want user to be able to sign up for a test environment with the same account as they do on production.
I checked the solution here: Firebase Auth across multiple projects with different Providers but unfortunately it's not working for me. I am getting "This operation is restricted to administrators only."
Currently my code looks as following:
DB / Firebase setup
constructor() {
this.app = firebase.initializeApp(environment.firebase);
this.database = firebase.initializeApp(environment.database, 'secondary');
}
DB Auth
private async initializeDb(firebaseUser) {
const token = await firebaseUser.getIdToken();
const provider = new firebase.auth.OAuthProvider('oidc.prod-login');
const credential = provider.credential({ idToken: token });
await this.firebaseService.database.auth().signInWithCredential(credential);
return firebaseUser;
}
In my test environment I configured the OIDC provider as following:
name: prod-login client ID: main-firebase-project-id issuer: https://securetoken.google.com/main-firebase-project-id
Did I miss something?