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

260
Views
Firebase Auth, how to return data (cred) inside Then block

I have a issue, i'm trying to write my own firebase fonctions using firebase code. The thing is im using react and i need to retrive data from THEN method and returning doesnt work

enter image description here

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

One way is to use promises. This will return the value of the user after the function is ready.

Good luck!

const auth_connectedUser = (auth, email, password) => {
  return new Promise((resolve, reject) => {
      signInWithEmailAndPassword(auth, email, password)
      .then(user => {
        console.log(user)
        return resolve(user)
      }).catch(err => {
        return reject(new Error(err))
      })
  })
}



const authUser = await auth_connectedUser(auth, email, password)

about 4 years ago · Juan Pablo Isaza Report

0

You must return the base async function. So, put the return keyword before signInWithEmailAndPassword function.

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!