I see AppWrite includes several function samples for adding numbers and some other non-sense, but it does not include the most important samples: email verification and password reset.
I've tried every possible way to create a reset password function in appwrite, using NodeJS and i failed day after day.
Anyone knows how to do it using the Appwrite cloud functions? it would be great to have it as an example.
Also, do we need to setup the snmp and pay for "pro" to be able to verify emails on appwrite cloud?
btw I tried this code and it didn't work. ```import { Client, Databases, Query, ID } from 'node-appwrite'; import querystring from 'node:querystring';
// This is your Appwrite function // It's executed each time we get a request export default async ({ req, res, log, error }) => { // Why not try the Appwrite SDK? // const client = new Client() .setEndpoint('https://cloud.appwrite.io/v1') .setProject(process.env.APPWRITE_FUNCTION_PROJECT_ID) .setKey(process.env.APPWRITE_API_KEY);
const account = new Account(client);
const promise = account.updateRecovery(req.query.userId, req.query.secret, 'password', 'password');
promise.then(function (response) { log(response); return res.send(response); }, function (error) { error(error); return res.send(error); });
return res.send('userid:'+req.query.userId+' secret:'+req.query.secret);```
First off, you don't seem to be importing Account
Second, I see you're using the Server SDK. In the Server SDKs, you can use users.updatePassword('[USER_ID]', 'newpassword') to update a users password
You can set whether or not a user's email address is verified with users.updateEmailVerification()
Note that most Account functions require you to be in a user context. To do this, you either need to be signed into a user (with a Client SDK), or you can generate a JWT (with account.createJWT()) on the client side, pass that to the Function and then use client.setJWT()
Recommended threads
- [v1.8.1] Getting error "(role: applicati...
... but that scope doesn't exist. I am trying to get a function to run and modify tables in the database dynamically. I set everything up and eventually got: ...
- Scheduled function silently stopped firi...
Function is scheduled `* * * * *` and is `enabled: true`, but Appwrite Cloud has stopped queueing executions. Last execution: **2026-05-30 00:47 UTC** (~46h...
- Unable to create Sites or Functions with...
Heya, I was looking at the appwrite documentation for Sites API with the server api: https://appwrite.io/docs/references/cloud/server-nodejs/sites I can’t fin...