Authentication / 05
Forgot and change password
Use challenge-based password reset instead of the retired legacy flow.
1. Request reset
Show a neutral confirmation message even if the email does not exist. Response accepted:true is not proof that an account exists.
typescript
await auth.human.forgotPassword(email);2. Verify and set a new password
Read challengeId and proof from the delivered reset message. The proof may be an OTP or link value. Submit both proof and new password. Expired or invalid challenges require a fresh request.
typescript
await auth.human.resetPassword({
challengeId, method: "otp", value: otp, newPassword,
});
// Return to login; do not assume authenticated.3. Change an existing password
For authenticated users, collect current and new password. Reconcile the SDK snapshot and any loginRequired receipt; do not keep an old session alive.
typescript
await auth.human.changePassword(currentPassword, newPassword);