Firebase Auth using phone number and password

前端 未结 4 1423
抹茶落季
抹茶落季 2021-02-04 14:11

I am developing Android app using Firebase. Because of that, I want to use Firebase Auth. I have following requirements:

  • Register/Log in using Facebook
  • Re
4条回答
  •  耶瑟儿~
    2021-02-04 14:55

    Use Fake Email:

    Well, Firebase doesn't support sign in with mobile number and password but it supports email and password. So you can create a fake email with your mobile number.

    Ie: 78******69@yourdomain.com

    Also, you can create a complete Authentication system using it.

    Registration:

    • Input user mobile and password and proceed to the next page.

    • Now use Firebase Phone Auth (OTP) to createUser. If process success, link fake email, password credentials in background.

      AuthCredential credential = EmailAuthProvider.getCredentialWithLink(email, emailLink); auth.getCurrentUser().linkWithCredential(credential);

    Login:

    • Input mobile and password to login. Convert the mobile in fake email and then signInWithEmailAndPassword().

    Forget Password:

    • Redirect the user to a new Page and user Phone Auth to verify the user. If successful, input a new password and change the password of the Email Auth.

提交回复
热议问题