Mutations
useResetPasswordOtp
Reset a password with an emailed code.
There is no token in the URL: the code and the new password are submitted in one call.
Usage
import type { EmailOtpAuthClient } from "@better-auth-ui/core/plugins/email-otp"
import { useAuth } from "@better-auth-ui/react"
import { useResetPasswordOtp } from "@better-auth-ui/react/plugins/email-otp"
const { authClient } = useAuth()
const { mutate: resetPasswordOtp } = useResetPasswordOtp(
authClient as EmailOtpAuthClient
)
resetPasswordOtp({
email: "[email protected]",
otp: "123456",
password: "new-password"
})useResetPasswordOtp requires the Better Auth emailOTP plugin. Cast authClient to EmailOtpAuthClient so TypeScript picks up the plugin-extended method signature.
Options factory
import { resetPasswordOtpOptions } from "@better-auth-ui/core/plugins/email-otp"
import { useMutation } from "@tanstack/react-query"
const { mutate } = useMutation(resetPasswordOtpOptions(authClient))Params
Prop
Type
Last updated on