I am using plugin

<type name="Magento\Customer\Model\AccountManagement">
    <plugin name="custom_change_reset_password_link_token"

and using Around on method aroundChangeResetPasswordLinkToken but problem is it is working on APIs but when I try to access the reset link on web it always gives me error

Your password reset link has expired.

Here is my implementation

* @param AccountManagement $subject
* @param callable $proceed
* @param string $customerId
* @param string $newPasswordToken
* @return bool

public function aroundChangeResetPasswordLinkToken(
    AccountManagement $subject,
    callable $proceed,
) {
    $customToken = ( string ) $this->random->getRandomNumber( 100000, 999999 );
    return $proceed( $customerId, $customToken );

When I pass a 6 digits string directly it works for example

    return $proceed( $customerId, "123456" );

IDK what's the issue please help, Thanks in Advanced

1 Answer 1


Step 1: Request Customer Password Reset Token Using Magento 2 API Provided below is the complete structure of the Magento 2 API request to get the customer password reset token:

Method: PUT

URL: store_url/rest/V1/customers/password


  "email": "[email protected]",
  "template": "email_reset"

Step 2: Use Customer Password Reset Token to Set New Password Using Magento 2 API

Method: POST

URL: store_url/rest/V1/customers/resetPassword


  "email": "[email protected]",
  "resetToken": "0:3:DufpYnLrA+Kw5jmJUd6171AQSU2jgO+1AOp4AiIeibTHq5jgve+7ZBDvI62ihr1tDeBxYSmvtNILoeIk",

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.