Error Creating Users Firebase authentication – React Native

  Kiến thức lập trình

I have a relatively simple React-Native app. I am trying to implement Firebase Authentication. I am coding in VScode and in Xcode, I’m running my app on an IOS iPhone emulator.

My handleLogin function works just fine if I use existing users that I manually add to my FireBase Users.

This issue occurs when I try to create new users,
I receive this error:
Error creating account: Error: [auth/weak-password] The given password is invalid.

  const handleLogin = async (username: string, password: string) => {
    try {
      await auth.signInWithEmailAndPassword(username, password);
      setLoggedIn(true);
    } catch (error) {
      console.error("Error logging in:", error);
    }
  };

  const handleCreateAccount = async (username: string, password: string) => {
    try {
      await auth.createUserWithEmailAndPassword(username, password);;
      setLoggedIn(true);
    } catch (error) {
      console.error("Error creating account:", error);
    }
  };

I’m not sure how to get more information. I have tried passwords with varying lengths and complexities:

  1. THISdidNotWork41!2@
  2. asdf23ASDFlkj(asdf#@#ASDjads(#@)

I found the password requirements here

How do I correctly use createUserWithEmailAndPassword?

New contributor

Derek Ellsworth is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT