Skip to content
Init is coming / May 19 - 23
Back

Need some advice on how to check if account exists from a Function

  • 0
  • Auth
  • Cloud
Marcel
16 Feb, 2025, 12:17

We already use the Auth setup from Appwrite to login from the React app, which works great. Now, I want to create a feature where you can connect/invite another user by email. When you "friend" someone I need to check if the account yet exists in Appwrite, if not, send an email to create an account first. If it does exist, it will connect it in the database.

I understand I'll have to use a Function for this, but I can't find any relevant APIs to check if an account already exists or not. The only API I can find is to get the currently logged in user (not just any user by email).

How to approach this?

TL;DR
You need to check if an account exists in Appwrite from a Function. To accomplish this, you can create a custom API endpoint using Appwrite Functions that will check if the user account exists based on the provided email. You can use the Appwrite Users API to achieve this by fetching a user by their email address. If the user exists, you can proceed with connecting them in the database. If the user doesn't exist, you can trigger an email to prompt them to create an account first.
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