Using tenant IDs with auth instance in Nuxt 3 #1432
-
We've been working with Firebase and the Google Cloud Identity Platform. Currently, we have three stages: dev, staging, and prod. For each stage, we utilize different tenant IDs, which can be created at https://console.cloud.google.com/customer-identity/tenants. In one of our projects, I implemented the following code (excluding VueFire) to switch the tenantId for each build: const tenantId = process.env.VUE_APP_FB_TENANT_ID;
const firebaseConfig = {
apiKey: "...",
authDomain: "...",
projectId: "...",
storageBucket: "...",
messagingSenderId: "...",
appId: "...",
};
const firebase = initializeApp(firebaseConfig);
const auth = getAuth(firebase);
auth.tenantId = tenantId || "...";
export { auth }; Now, I aim to integrate this structure into our Nuxt 3 project with VueFire. I've added: // nuxtconfig (ssr: false)
...
vuefire: {
auth: {
enabled: true,
// tenantId: "..." maybe?
},
config: {
apiKey: process.env.FB_API_KEY,
appId: process.env.FB_APP_ID,
authDomain: process.env.FB_AUTH_DOMAIN,
measurementId: process.env.FB_MEASUREMENT_ID,
messagingSenderId: process.env.FB_MESSAGING_SENDER_ID,
projectId: process.env.FB_PROJECT_ID,
storageBucket: process.env.FB_STORAGE_BUCKET,
},
}, I'm trying to access the auth instance to assign the tenantId. Unfortunately, I haven't found any information related to accessing instances in the documentation. Do you know how I might achieve this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I believe this is the correct link: https://vuefire.vuejs.org/guide/auth.html#Auth-instance. I was unable to test it, but do it soon. |
Beta Was this translation helpful? Give feedback.
I think you should be able to call
useFirebaseAuth()
in a Nuxt plugin and ad the tenantId there