If not, how can I verify the emails of users which would be registering using email otp?
OTP is the secret, so it should be fine.
If that's the case, then why am I getting these error?
can you show some relevant code?
sdk versions would be good too in the details.
`export const register = async (email, password, name) => { try { const user = await account.create("unique()", email, password, name); if (user) { // Automatically log in after registration account.createEmailToken(ID.unique(), email, true).then( function (response) { console.log("Success sending otp"); // Success return response; }, function (error) { console.log("Failure sending otp", error); // Failure } ); // const session = await account.createSession(user.$id, secret); secret is the otp return { success: true, // data: session.data, emailVerification: user.emailVerification, userId: user.$id, // Return userId for OTP verification }; } return { success: false, error: "Registration failed" }; } catch (error) { console.error("Registration error:", error); return { success: false, error: error.message }; } };
export const verifyOTP = async (userId, secret) => { console.log("userId", userId, "\nOTP: ", secret); try { const response = await account.updateVerification(userId, secret); //I think it doesn't works with the otp response.then( function (response) { console.log("Verification was successful! \n", response); // Success }, function (error) { console.log("there was some error verifying the user \n", error); // Failure } ); return { success: true, data: response }; } catch (error) { console.error("OTP verification error:", error); return { success: false, error: error.message }; } };`
idk about sdk version but I am using appwrite 14.0.1
aah I see. My bad, you should be able to directly create a session. See - https://appwrite.io/docs/products/auth/email-otp
It means there is no way to verify a user through otp login?
looking at the source, once the session is created via magic-url or otp, the email should be marked as verified.
ooh, if that's the case. It would be nice!
Recommended threads
- Does Appwrite allow SSE ?
i'm trying to setup a slack bot on my site. Your deployed SSE endpoint is returning a non‑SSE response …and the browser immediately closes the connection. read...
- Endless certificate generation cycle
Hello, when I try to add the subdomain stats.hedgehog-rp.ru, I get an infinite loop while the certificate is being generated. There are no problems with adding ...
- Realtime not working for some tables
Hi, I've got an issue where I can setup a realtime connection to listen to some tables, but some not all. I have two tables `history` and `users`. Both can be ...