Back

[SOLVED] how to to log in with both an email and a phone number on the same account

  • 0
  • Flutter
conqueror
31 May, 2023, 12:46

How to achieve this.

TL;DR
The user wants to know how to log in with both an email and a phone number on the same account. The support team suggests creating a function using the Users server SDK to check if the user was created with a phone and then use the updateEmail function to set an email for that user. This will allow the user to log in using either their email or phone number.
Binyamin
31 May, 2023, 12:53

I don't this that there is a direct way to achieve that.

But, what you can do is to create a function to handle this.

Inside of the function use the Users server SDK to get the user https://appwrite.io/docs/server/users?sdk=nodejs-default#usersGet

Now, you can check if the user has only phone, that mean this user was created with a phone.

Then you can use updateEmail to set email for that user. https://appwrite.io/docs/server/users?sdk=nodejs-default#usersUpdateEmail

So the user will be able to login using email or phone.

conqueror
31 May, 2023, 12:55

will appwrite charge for authencation ?

Binyamin
31 May, 2023, 12:56

You mean in the cloud? for the SMS?

conqueror
31 May, 2023, 12:56

yes

Binyamin
31 May, 2023, 12:56

Now it's free part of the public beta. I think is going to be some pricing - or at least some limits on the free tier - when it will go public.

conqueror
31 May, 2023, 12:57

Thanks @Binyamin

joeyouss
31 May, 2023, 15:17

As of now, we do not have pricing, we will do in future but we are going to definitely have a generous free tier as well @conqueror

joeyouss
31 May, 2023, 15:17

[SOLVED] how to to log in with both an email and a phone number on the same account

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more