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
- Problem with email links
Hi. I'm receiving emails without working links, the text that is suposed to be a link is plain text...
- Issue with downloading large files (40GB...
Hi everyone! I am using the latest Appwrite 1.8.0 version on my self-hosted server. I successfully uploaded a large ZIP archive (~40GB) using the chunked uploa...
- Firebase app import
I'm **very** new to appwrite and I just set up appwrite with docker and I'm trying to import a Firebase app I have set up but it's erroring and I don't really k...