StarckisBack
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 -
TypeScript
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,
);
}
}
TL;DR
Developers are setting up email OTP authentication for a React app using NestJS backend with appwrite-node SDK. They are encountering an issue where createEmailToken with sessionClient gives an empty secret, but with adminClient, it provides a secret OTP. Additionally, developers need assistance with verifying the OTP and accessing email templates from the Node SDK. Recommended threads
- Users Create Event Not Triggered
- Issues I am facing with Appwrite
I am using Appwrite in my Android App to learn Jetpack Compose. I have integrated Authenitcation, Database, Storage. In authentication I am not receiving SMS in...
- My deployment status is active and it sh...
{ "motto": "Build like a team of hundreds_", "learn": "https://appwrite.io/docs", "connect": "https://appwrite.io/discord", "getInspired": "https://builtwith.ap...