-1

OTP is the only mode of signing in. If the user is registered then he must go to the landing page if not should go the registration page and need to write that information to firebase?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Pranav Arora
  • 3
  • 2
  • 6

1 Answers1

0

You can check if a user is already registered with a certain email address by calling the fetchSignInMethodsForEmail method.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • The app doesn't ask for email it just sign in with the OTP then how can we check? – Pranav Arora Dec 07 '19 at 05:07
  • There is no similar method for phone number verification. It might be useful if you show what you're actually trying to accomplish, as this type of check is generally not needed with Firebase, as the user's authentication state is automatically restored when you restart the app. – Frank van Puffelen Dec 07 '19 at 05:12
  • Basically I'm building an app whose first page is the authentication page right now it is sending otp to every number entered what I want to accomplish is that if the number is already their in our firebase then it should take the user to the landing page if the number is not there in the firebase then first it should take the user to the register form where I want certain details from him which should be stored and then take him to the landing page. – Pranav Arora Dec 07 '19 at 07:17
  • It's hard to help without seeing the code of what the registration form does, but since there isn't a method to see if a given number is already registered, you'll need to store the numbers that are registered somewhere yourself. See for example https://stackoverflow.com/a/49768314, https://stackoverflow.com/a/52677130, and https://stackoverflow.com/a/50317672. – Frank van Puffelen Dec 07 '19 at 15:47
  • How shall I share the code for the registration page with you? – Pranav Arora Dec 07 '19 at 19:12
  • You can edit the question to include the code, but please read [how to create a minimal, complete, verifiable example](http://stackoverflow.com/help/mcve) as first isolating the problem is key to maximizing the chances we can help you. – Frank van Puffelen Dec 07 '19 at 21:12