Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

194
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda