1

I'm working on Firebase authentication within my Next.js app. After a user signs up using email and password, I require account verification during their initial login. However, after account verification, an issue arises on the second login attempt after signing out. Firebase throws an "incorrect password" error, despite the account being verified.

Interestingly, when I manually reset the password via the Google console, I can successfully log in with the new password. I'm puzzled by this behavior. Any insights into why Firebase is presenting this error post-verification would be greatly appreciated.

I tried to verify my account that is what I successfully did but I'm unable to log in after verifying my account if I log out and try to log in again. Got an incorrect password error.

Here is my login code:

data: {
        "returnSecureToken": true,
        "email": "junaid223@yopmail.com",
        "password": "Test123!@#",
        "clientType": "CLIENT_TYPE_WEB"
       }

const onSubmit = async (data) => {
   try {
        signInWithEmailAndPassword(auth, data?.email, data?.password)
          .then(async (res) => {
            if (res?.user?.uid) {
              //create profile
            }
          })
          .catch (error) {
        // Handle error here
        toast.error("Login failed. Please check your email and password.");
      } catch (error) {
        // Handle error here
        toast.error("Login failed. Please check your email and password.");
        console.error(error);
      }
    }

    "error": {
        "code": 400,
        "message": "INVALID_PASSWORD",
        "errors": [
            {
                "message": "INVALID_PASSWORD",
                "domain": "global",
                "reason": "invalid"
            }
        ]
    }

Surprisingly on the first login it works fine but then for subsequent logins it fails. Any help would be appreciated!

0 Answers0