This is my code
TypeScript
import { ID } from "appwrite";
import { account } from "$lib/appwrite";
const createUserService = () => {
async function register(email: string) {
try {
await account.createMagicURLToken(ID.unique(), email);
} catch (error: any) {
console.log(error);
throw new Error(error);
}
}
return {
register
};
};
const userService = createUserService();
export default userService;
TypeScript
// $lib/appwrite/index.ts
import { Account, Client, Databases } from "appwrite";
const APPWRITE_ENDPOINT = import.meta.env.VITE_APPWRITE_ENDPOINT;
const APPWRITE_PROJECT_ID = import.meta.env.VITE_APPWRITE_PROJECT_ID;
const client = new Client().setEndpoint(APPWRITE_ENDPOINT).setProject(APPWRITE_PROJECT_ID);
export const account = new Account(client);
export const databases = new Databases(client);
I want to verify if user exists in Auth database and send message if user already exists in the database. But I don't know how I could find the way to implement it.
TL;DR
Developers want to check if a user's email is already registered in an Auth database. They provided code for registering users but need help verifying existing users. To implement this, they can use the account.list() method from Appwrite, passing the email as a search parameter and checking if any user matches.Recommended threads
- Appwrite Sites: ERR_TOO_MANY_REDIRECTS o...
So, my domain was working perfectly fine with Vercel. I was using cloudflare CDN (still am) but CNAME was DNS-only. I switched over to appwrite, CNAME is still ...
- How to disable appwrite/embedding from s...
Hi everyone! I'm currently running a self-hosted instance of Appwrite. For my current use case, I don't need the AI/embedding features, and I noticed the `app...
- Invalid type for attribute 'email': emai...
I'm using the node-appwrite SDK to create a table, the column payload looks like this: ```json [{"key":"email","type":"email","required":true, "size": 512}] ``...