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

192
Views
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 answers
Answer question

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 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!