requestResetPassword
Returns a reset password token for the customer with the passed in login that can be used with the requestPassword method to change that customer's password.
This method communicates with the requestResetPassword endpoint of the Vue Storefront API Middleware. In turn, it receives data from the getPasswordResetToken or the Reset Password Token endpoints exposed by SCAPI / OCAPI depending on the middleware configuration.
It's important to avoid exposing the generated token to the client. When a token is created, the onPasswordResetTokenGenerated auth callback you've provided to the middleware will be called with a payload of type ResetPasswordToken
You can use that data to send a password reset link or the token itself to customers via a secure channel. They can then use that information to finish the reset process
Signature
export declare function requestResetPassword(
props: RequestResetPasswordParams
): Promise<RequestResetPasswordResult>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
props | Required | RequestResetPasswordParams | Parameter object which can be used with this method. Refer to its type definition to learn about possible properties. |
Returns
Status object for the token generation process, along with data returned by the callback.
Referenced Types
RequestResetPasswordParamsRequestResetPasswordResult
Examples
Requesting a reset token for a customer with a given login.
import { sdk } from '~/sdk.config.ts';
const result = await sdk.commerce.requestResetPassword({ login: 'email@provider.com' });