Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

276
Views
Are you supposed to pass the firebase app to getAuth() or leave the arguments as blank?

The firebase docs show them using the app instance inside the getAuth() call, in one portion of the docs

import { initializeApp } from "firebase/app";
import { getAuth } from "firebase/auth";
const firebaseConfig = {
  // ...
};
const app = initializeApp(firebaseConfig);
const auth = getAuth(app); //I'm talking about this line

Then in the very next section on the same page, they go ahead and use getAuth() without the app instance, in order to sign in a user with email.

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

const auth = getAuth();
createUserWithEmailAndPassword(auth, email, password)
  .then((userCredential) => {
    const user = userCredential.user;
  })
  .catch((error) => {
    console.log(error)
  });

What is the correct way to use it?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The getAuth() function without parameters will use the default initialized instance of Firebase. If you have multiple instances of Firebase i.e. multiple projects, then you must pass the app instance to specify which project's auth that auth instance must use.

const app1 = initializeApp(project1Config);
const app2 = initializeApp(project2Config, "app2");

const auth1 = getAuth(); // or getAuth(app1), uses app1 as it's default, 

const auth2 = getAuth(app2); // uses app2
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!