usePassword
Password change for signed-in users and the reset-by-key flow for everyone else.
Result
ts
interface UsePasswordResult {
change(input: ChangePasswordInput): Promise<void>
requestReset(email: string): Promise<void>
confirmReset(input: ConfirmPasswordResetInput): Promise<AuthFlowResponse>
}Example
tsx
import { usePassword } from 'react-allauth'
function ResetPassword({ resetKey }: { resetKey: string }) {
const { confirmReset } = usePassword()
async function submit(password: string) {
const response = await confirmReset({ key: resetKey, password })
if (response.errors?.length) {
// show field errors
}
}
// ...
}Notes
changeandrequestResetare mutations: they throwAllauthRequestErroron failure.requestResetintentionally does not reveal whether the email exists.confirmResetis a flow method: it returns the envelope (the user may be signed in directly depending on backend settings) — readresponse.errors.- The reset key arrives by email at the URL configured in
HEADLESS_FRONTEND_URLS["account_reset_password_from_key"]; route it to your form.