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

200
Visualizações
firebaseApp.auth is not a function (user authentication with Firebase)

I'm trying to set up user authentication with Firebase for my React webapp, but I'm running into errors with the firebaseAuth.app() function. I've tried reinstalling firebase and the firebase admin in the project directory, converting to SDK 9 syntax for the imports, and reordering certain statements, but nothing seems to be working. Here is my App.js file:

import withFirebaseAuth from 'react-with-firebase-auth'
import firebase from 'firebase/compat/app';
import 'firebase/auth';

import firebaseConfig from './firebaseConfig';

import "firebase/compat/app";
import "firebase/compat/analytics";

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

const firebaseApp = firebase.initializeApp(firebaseConfig);

const firebaseAppAuth = firebaseApp.auth();
const providers = {
  googleProvider: new firebase.auth.GoogleAuthProvider(),
};

const {
  user,
  signOut,
  signInWithGoogle,
} = this.props;

function App() {
  return (
    <div className="App">
    <header className="App-header">
    <img src={logo} className="App-logo" alt="logo" />
    {
      user
        ? <p>Hello, {user.displayName}</p>
        : <p>Please sign in.</p>
    }
    {
      user
        ? <button onClick={signOut}>Sign out</button>
        : <button onClick={signInWithGoogle}>Sign in with Google</button>
    }
  </header>

    </div>
  );
}

export default withFirebaseAuth({
  providers,
  firebaseAppAuth,
})(App);

I have a firebaseConfig.js file as well with the configuration information. Sorry for any newb-ness, as I'm new to React. Can anyone help resolve this error?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Try changing all of your imports to compat version:

import withFirebaseAuth from 'react-with-firebase-auth'
import firebase from 'firebase/compat/app';
import 'firebase/compat/auth';
import "firebase/compat/app";
import "firebase/compat/analytics";

import firebaseConfig from './firebaseConfig';

I'd recommend checking out and upgrading to new Modular SDK but I'm not totally sure if it'll work with 'react-with-firebase-auth' or any other libs.

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