Anonymous
Anonymous4w ago

Got invalid code error on reset password

<input name="email" value={step.email} type="hidden" /> <input name="flow" value="reset-verification" type="hidden" /> const handleResetPassword = async (event: any) => { event.preventDefault(); const formData = new FormData(event.currentTarget); console.log("formDtaaaaa", formData); void signIn("password", formData); } i have passed the same code as received in email but got this error chunk-SSHQXKLM.js?v=638577a8:2460 Uncaught (in promise) Error: [CONVEX A(auth:signIn)] [Request ID: 0aab4165e92d0333] Server Error Uncaught Error: Invalid code Called by client
7 Replies
Convex Bot
Convex Bot4w ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
Clever Tagline
I don't think you shared enough of the relevant parts of your code, specifically the Convex-related bits. Please also elaborate more on the steps you're taking, and what you've tried so far to fix the problem.
Anonymous
AnonymousOP4w ago
i am geeeting issue of invalid code as i am passsing the exact code but it shows you have invalid code //convex/passwordReset/ResendOTPPasswordReset import Resend from "@auth/core/providers/resend"; import { Resend as ResendAPI } from "resend"; export const ResendOTPPasswordReset = Resend({ id: "resend-otp", apiKey: process.env.AUTH_RESEND_KEY, async generateVerificationToken() { // Generate 8-digit numeric token using Web Crypto API const array = new Uint32Array(1); crypto.getRandomValues(array); return (array[0] % 100000000).toString().padStart(4, '0'); }, async sendVerificationRequest({ identifier: email, provider, token }) { const resend = new ResendAPI(process.env.AUTH_RESEND_KEY!);
try { const { data, error } = await resend.emails.send({ from: "onboarding@resend.dev", to: email, // Use the actual recipient email subject: Password Reset Verification, html: <p>Your password reset code is: <strong>${token}</strong></p> <p>This code will expire in 15 minutes.</p> , text: Your password reset code is ${token}, }); if (error) { console.error("Resend error:", error); throw new Error("Failed to send verification email"); } console.log("Email sent:", data?.id); } catch (err) { console.error("Email sending failed:", err); throw err; } }, }); //auth.ts export const { auth, signIn, signOut, store, isAuthenticated } = convexAuth({ providers: [Password({ reset: ResendOTPPasswordReset })], }); [CONVEX A(auth:signIn)] [Request ID: fe930db288df80d7] Server Error Uncaught Error: Invalid code @Clever Tagline Could you please help me in this cae
Clever Tagline
Sorry, but I can't. I've not used the Resend component yet, and I'm having a hard time understanding the code you shared.
Anonymous
AnonymousOP3w ago
is there any alternate where i can find the solution
Clever Tagline
As your question is specific to a component, you could try making a thread in #components . Might get more traction there. 🤷‍♂️ That aside, this channel is community support, so it's all a matter if others in the community know how to help. The devs sometimes chime in, but there's no guarantee. Also, when putting code into a post, I recommend using markdown so it's easier to read. For example: ```js // Some code here const x = "x" ``` becomes:
// Some code here
const x = "x"
// Some code here
const x = "x"
erquhart
erquhart3w ago
They aren't using the Resend component, this is just Convex Auth + Resend sdk @Anonymous I recommend comparing your setup to the Convex Auth/Resend setup in the convex-saas starter: https://github.com/get-convex/convex-saas/blob/c8e760bbf727cfbeca269bedc41c24f72e11737b/convex/otp/ResendOTP.ts

Did you find this page helpful?