Search code examples
androidfirebasefirebase-authenticationreal-time

User validation before phone authentication


I want to validate user phone number exists in Firebase before phone authentication. And if user exists then only OTP verification will start otherwise show error. Kindly help me out please


Solution

  • You can use the Admin SDK to lookup a user by phoneNumber: admin.auth().getUserByPhoneNumber(phoneNumber)

    This will help you check if a user record with this phone number already exists.

    Learn more by visiting the documentation.

    You can create an HTTP endpoint to do so.