HarmonyOS Native SDK
User Account
Password Recovery

Password Recovery

Recover by mobile number

await userManager.sendMobileForgotPasswordVerifyCode('+1', phone, 'en-US');
await userManager.forgotWithMobile('+1', phone, verificationCode, newPassword);

If sending the SMS verification code throws GizCaptchaRequiredError, complete the mobile SMS captcha, then retry with GizCaptchaInput as the fourth argument:

await userManager.sendMobileForgotPasswordVerifyCode(
  '+1',
  phone,
  'en-US',
  captchaInput
);

Recover by email

await userManager.sendEmailForgotPasswordVerifyCode(email, 'en-US');
await userManager.forgotWithEmail(email, verificationCode, newPassword);

Log in again with the new password after a successful reset. Invalid or expired codes, rate limits, and network failures reject the Promise.