customerResetPassword
Reset customer password based on the token value.
It sends a request to commercetools GraphQL API to reset the customer's password based on the token value. Password Flow.
By default, it uses the customerResetPasswordDefaultQuery GraphQL query.
Signature
declare function customerResetPassword(
context: CommercetoolsIntegrationContext,
tokenValue: string,
newPassword: string,
customQuery?: CustomQuery
): Promise<CustomerResetPasswordResponse>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
context | Required | CommercetoolsIntegrationContext | |
tokenValue | Required | string | |
newPassword | Required | string | |
customQuery | Optional | CustomQuery |
Returns
Returns a representation of the CustomerResetPasswordResponse.
Referenced Types
Examples
Generate password reset token, reset password and sign in with new password.
// Generate password reset token
const { customerCreatePasswordResetToken } = await sdk.commerce.customerCreatePasswordResetToken(
TEST_SIGN_UP_EMAIL
true
);
// Reset password
await sdk.commerce.customerResetPassword(
customerCreatePasswordResetToken.value
NEW_PASSWORD
);
// Sign in with new password
const { user } = await sdk.commerce.signIn({
email: 'your@email.com,
password: NEW_PASSWORD
});