Change/reset customer password via SDK

I know it’s possible to register my customers using the Javascript SDK, but the interface doesn’t seem to have a method to allow my customer to change their password or reset in the event they forget it?

Hi @gcm,

We do have methods for this available on the Customer API, but to be honest, this is more catered towards internal use as it isn’t publicly documented.

I’ll still leave their definition here if you want to give it a shot. However, we can’t guarantee there won’t be breaking changes in our future releases.

    /**
     * Sends a password reset link email.
     * @param email The email of the customers account.
     */
    recoverPassword(email: string): Promise<void>;

    /**
     * Reset the password for a given customer.
     * @param password The new desired password.
     * @param confirmationPassword A confirmation password to avoid any typos.
     * @param token The validation token provided in the password recovery email.
     */
    resetPassword(password: string, confirmationPassword: string, token: string): Promise<void>;

        /**
     * Changes the password for a given customer.
     * @param password The new desired password.
     * @param confirmationPassword A confirmation password to avoid any typos.
     * @param currentPassword The current password.
     */
    changePassword(password: string, confirmationPassword: string, currentPassword: string): Promise<void>;
2 Likes

Okay, that’s useful but on a related topic are there any character or string length constraints for the password or is that up to me to enforce?

Hi @gcm, that is up to you to enforce.