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

169
Views
Firebase SignInWIthEmailAndPasswod doesn't work

I'm having issues implementing Login logic using Firebase email and password method. I've done everything according to documentation for 8 and 9 SDK versions but they don't work. To be more specific .then doesn't work. I've implemented register and sign out without any issue, but login doesn't do anything. Here is login:

import firebase from 'firebase/app'
import 'firebase/auth';
import { useHistory } from 'react-router-dom';

...

const loginUser = (email, password) => {
        firebase.auth().signInWithEmailAndPassword(email, password).then((userCredential) => {
            console.log('user', userCredential)
            history.push('/admin')
        })
        .catch((error) => {
            var errorCode = error.code;
            var errorMessage = error.message;
            console.error(errorCode, errorMessage)
        });
    }
}

...

Whatever I try to log in .then() nothing happens, there is also no error. In network tab verifyPassword request is cancelled.

I really don't understand what is wrong there since it should be easy implementation.

Thanks

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

0

firebase.auth()

is not available in Firebase V9. Make sure to read Docs of Firebase V9. Because Firebase V9 doesn't built-in Object-Oriented Way. It was built with Functional Way.

You can change as

import { initializeApp } from 'firebase/app';
import { getAuth, signInWithEmailAndPassword } from 'firebase/auth';

const firebaseConfig = {
       ////
}
initializeApp(firebaseConfig)

const auth = getAuth()
const loginUser = (email, password) => {
    signInWithEmailAndPassword(auth, email, password).then((userCredential) => {
            console.log('user', userCredential)
            history.push('/admin')
        })
        .catch((error) => {
            var errorCode = error.code;
            var errorMessage = error.message;
            console.error(errorCode, errorMessage)
        });
    }
}

Kindly read the Documentation to your doubts. I would recommend you to watch Net Ninja's Firebase V9 Click here

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!