user8615417
user8615417

Reputation:

Know what appId is used in firebase authentication

I have 3 web applications in my firebase project, dev, stg and prod. In my front end project, I configured it so that each environment uses an appId. I want to be able to know from which appId is the user authenticated. Is that possible ? enter image description here

Upvotes: 1

Views: 12064

Answers (2)

black-purple
black-purple

Reputation: 89

I know this might be late but it might help others still looking for an answer.

You can get your appId in the apps section under project settings

Open your firebase console and go to project settings from here ->

enter image description here

Under General, scroll down to your apps section and you'll find appids for each app of yours

enter image description here

Upvotes: 2

Renaud Tarnec
Renaud Tarnec

Reputation: 83183

You'll find this info in the FirebaseApp options object which, among others, contains the appId.

For example with the JS SDK v9:

import { getAuth, onAuthStateChanged } from "firebase/auth";

const auth = getAuth();
onAuthStateChanged(auth, (user) => {
  if (user) {
     console.log(auth.app.options.appId);
  } else {
    // User is signed out
    // ...
  }
});

Upvotes: 3

Related Questions