'How to check if a user phone number exists using firebase auth? [duplicate]
I'm building an app where i prompt the user to authenticate with their phone number in the first place. if the user phone number doesn't already exist he's redirected to a page with username and password. IF he exists, he's prompted to the password page directly.
How i can check if the user phone number already exists (or not) before knowing which page he will be sent?
i did check the docs, i found this solution
getAuth()
.getUserByPhoneNumber(phoneNumber)
.then((userRecord) => {
// See the UserRecord reference doc for the contents of userRecord.
console.log(`Successfully fetched user data: ${userRecord.toJSON()}`);
})
.catch((error) => {
console.log('Error fetching user data:', error);
});
But i need to it run in a backend server. What i want is something similar but that i will use in the front ( i'm using react ). Firebase offers plenty of methods in the front-end for authentication of the user. Where can i find one that fetches it ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
