Alokai
You are reading the documentation for SDK v2, which is no longer the latest version. Switch to current

customerChangePassword

Method for changing the customer's password.

This method sends a POST request to the customerChangeMyPassword endpoint of the Vue Storefront API Middleware. It sends a request to commercetools GraphQL API to change the customer's password based on the Password Flow.

The default GraphQL query used by this method can be found here. You might also want to see the customerResetPassword method.

Signature

export declare function customerChangePassword<Res extends CustomerChangeMyPasswordResponse>(
	params: CustomerChangePasswordParams,
	options?: MethodBaseOptions
): Promise<Res>;

Parameters

NameRequiredTypeDescription
paramsRequiredCustomerChangePasswordParamsParameter object which can be used with this method. Refer to its type definition to learn about possible properties.
optionsOptionalMethodBaseOptionsOptions that can be passed to additionally configure the request or customize the logic in a plugin.

Returns

Returns a representation of the CustomerChangeMyPasswordResponse.

Referenced Types

Examples

This example shows how to change the customer's password:

import { sdk } from '~/sdk.config.ts';

// Change password
await sdk.commerce.customerChangePassword({
 version: user.version, // user is the result of the customerLogin method
 currentPassword: 'current_password',
 newPassword: 'new_password'
});

On this page