shera_xOriginal post
Web Developer
Hi, my app uses only phone number based OTP authentication. As far as I know, appwrite creates a new user if a user is not present with that phone number. And I want the client to get an error if the phone number they gave is already registered. Is there a way to achieve this in appwrite?
Summary
To check if a phone number already exists during OTP authentication in Appwrite, you cannot directly do this using the client SDK. However, you can use server API functions to achieve this.
Here's how you can do it:
1. Use a server API function to check if a user with the provided phone number already exists.
2. Call this function using the client SDK.
3. If the function returns a user, it means the phone number is already registered and you can handle the error on the client side.
By following these steps, you can ensure that the client receives an error if the phone number they provided is already registered.