Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

197
Visualizações
auth.signOut() or signOut(auth). Is there any difference or major advantage with any of them?

Is there any difference or major advantage with using auth.signOut() or signOut(auth) of them? This principle for sure also affects the same pattern for logging in, signing up, and so on. The firebase documentation (Web9) only uses the approach with functions signOut(auth). But most articles or tutorials using auth.signOut(). I guess it's a very basic question but I've seen everyone approaching it differently so I'm glad to solve this in the best way possible.

firebase.js

import { initializeApp } from "firebase/app";
import { getAuth } from "firebase/auth";

const firebaseConfig = {
  apiKey: "",
  authDomain: "",
  projectId: "",
  storageBucket: "",
  messagingSenderId: "",
  appId: "",
  measurementId: "",
};

const app = initializeApp(firebaseConfig);

export const auth = getAuth(app);
export default app;

Auth1.js

import { auth } from "./firebase.js";

// Option 1
function logout() {
  return auth.signOut();
}

Auth2.js

import { signOut } from "firebase/auth";
import { auth } from "./firebase.js";

// Option 2
function logout() {
  return signOut(auth);
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The .js firebase SDK has a version 9 with is a major refacto to lighten the lib and bring a lot of new features (tree-sharing for eg).

auth.signOut is version 8, doc here
signOut(auth) is version 9, doc here

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda