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

112
Views
app.auth is not a function error in firebase react

Im trying to connect firebase with a react app, but I get the Uncaught TypeError: app.auth is not a function error when trying to create an auth variable export const auth = app.auth()

This is the code:

import firebase from 'firebase/compat/app';
import 'firebase/auth';

const app = firebase.initializeApp({
    apiKey: process.env.REACT_APP_FIREBASE_API_KEY,
    authDomain: process.env.REACT_APP_FIREBASE_AUTH_DOMAIN,
    projectId: process.env.REACT_APP_FIREBASE_PROJECT_ID,
    storageBucket: process.env.REACT_APP_FIREBASE_STORAGE_BUCKET,
    messagingSenderId: process.env.REACT_APP_FIREBASE_MESSAGING_SENDER_ID,
    appId: process.env.REACT_APP_FIREBASE_APP_ID
})

export const auth = app.auth()
export default app; 
about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Use getAuth instead of app.auth:

import firebase from 'firebase/compat/app';
import {getAuth} from 'firebase/auth';

const app = firebase.initializeApp({
    ...
})

export const auth = getAuth()
export default app; 

about 4 years ago · Santiago Trujillo Report

0

If you want to use the namespaced syntax then you must import compat version of Firebase Auth SDK as well.

import firebase from 'firebase/compat/app';
import 'firebase/compat/auth'; // <-- add /compat/

The compat libraries are a temporary solution that will be removed completely in a future major SDK version (such as version 10 or version 11). Your ultimate goal is to remove compat code and keep only version 9 modular-style code in your app.

Checkout the documentation for more information.

about 4 years ago · Santiago Trujillo 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!