
Hello, I am trying to setup a email otp auth for my react application via nestjs backend which is using appwrite-node sdk.
Here, when i am triggering createEmailToken with sessionClient its giving a empty secret whereas with adminClient it was giving a secret otp.
Also please let me know how to verify otp and also if we can access the email templates from node sdk.
Here's my code -
this.sessionClient = new Client()
.setEndpoint(this.configService.get<string>('APPWRITE_ENDPOINT'))
.setProject(this.configService.get<string>('APPWRITE_PROJECT_ID'))
.setSelfSigned(true);
this.sessionAccount = new Account(this.sessionClient);
async emailOtp(email: string) {
try {
const result = await this.sessionAccount.createEmailToken(
ID.unique(),
email,
);
console.log('Inside emailOtp', result);
return {
message: 'Email OTP sent',
userId: result.userId,
email: email,
};
} catch (error) {
this.logger.error('Failed to create email token:', error);
throw new HttpException(
'Failed to create email token',
HttpStatus.BAD_REQUEST,
);
}
}
Recommended threads
- Flutter OAuth2 Google does not return to...
When the flow starts, the browser opens, I select an account, and it keeps showing: """ Page not found The page you're looking for doesn't exist. `general_rout...
- list() is very slow; eventually shows no...
When I use the web browser to view the collections in my database, the documents they contain are normally displayed within a few seconds. For a few days now, h...
- Can't start docker containers beacuse no...
Hi, I'm testing my app where I upload also files to appwrite storage. As I suspect, I've filled up my disk. Now I can't start Appwrite. Could I ask for help wit...
