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

221
Views
Firebase Auth v9: Object(...) no es una función

Necesito ayuda, estaba viendo un tutorial para firebase y react. y luego me di cuenta de que el tutorial era para v8 y el más nuevo es v9

este es mi base de fuego.js

 import { initializeApp } from 'firebase/app'; import { getAuth } from 'firebase/auth'; import { getDatabase } from "firebase/database"; const firebaseConfig = { //firebaseconfig }; const app = initializeApp(firebaseConfig); const auth = getAuth(app); const database = getDatabase(app); export { auth, database }

y luego este es mi código de fragmento signin.js

 import { auth, database } from "../Firebase/firebase"; const submitForm = async (values) => { auth() .signInWithEmailAndPassword(values.email,values.password) .then((userCredentials) => { props.history.push("/profile"); }).catch((err) => { setLoading(false); }); };

y luego, cuando envío mi formulario, la aplicación se bloquea con un error en la autenticación ().

 Unhandled Rejection (TypeError): Object(...) is not a function
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

import { auth, database } from "../Firebase/firebase"; // this ^^^^ is not a function but is being used as one // auth().signInWithEmailAndPassword(values.email,values.password) // ^^^^ here

signInWithEmailAndPassword debe importarse desde firebase/auth como se muestra a continuación:

 import { auth, database } from "../Firebase/firebase"; import { signInWithEmailAndPassword } from "firebase/auth" const submitForm = async (values) => { const userCredentials = await signInWithEmailAndPassword(auth, values.email, values.password) // Pass the 'auth' instance here ^^^^ const { user: { uid } } = userCredentials console.log(`userId: ${uid}`) }

Recomiendo seguir la documentación junto con cualquier tutorial. La documentación tiene una sintaxis de espacio de nombres (v8) y modular/funcional (v9).

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!