Email OTP verification error: Invalid token passed in the request
- 0
- Android
- Auth
- Apple
- Cloud
- React Native

Hello everyone, I have seen a few related posts about this but nothing related to react native. I am using email OTP to create an account. I provide an email and I get a 6-digit code. I use this code as the secret to be passed in updateVerification() to create a session but I get this error "Invalid token passed in the request." I have reviewed the documentation and, although it does not specify what the secret is, I think is obvious it should be that 6-digit number.
NOTE: the userId is extracted from the result value where the function is called.
export const sendVerification = async (email) => { try { const result = await account.createEmailToken( ID.unique(), email );
return result;
} catch (error) {
console.error("Error sending email:", error);
throw new Error("Failed to send email.");
}
};
export const verifyCode = async (id, code) => {
try {
const session = await account.updateVerification(
id,
code
);
return session;
} catch (error) {
console.error("Error validating token:", error);
throw new Error("Failed to validate token.");
}
};

FYI, it's best to wrap code in backticks to format a bit nicer. You can use 1 backtick for inline code (https://www.markdownguide.org/basic-syntax/#code) and 3 backticks for multiline code (https://www.markdownguide.org/extended-syntax/#syntax-highlighting).

Update verification is used with a different method

Did you read the docs on email OTP auth? https://appwrite.io/docs/products/auth/email-otp
Recommended threads
- Create platform and can not connect ping
I created a new platform but when I cloned the source, I didn't see the lib/... folder, only env. Then I created a .env file and added those files, then pinged ...
- 500 Error on Console when Using Custom D...
Hey 👋 I’ve set up a custom domain for my Appwrite Cloud project (<my-custom-domain>). DNS is configured and the organization view loads fine when I open the c...
- 2 Columns still processing since yesterd...
Hey o/ Yesterday (around <t:1758045600:f>), I created a database and added several columns to it. After about 15 minutes, most of the "processing" tags disappe...
