I need to change the customer's password in my custom theme

Paul_moro
New Member
1 0 0

I need change the passwod in my front end, i use this code:

 

  const xw = (i) => {
    let urlPassword = `https://--------.com/admin/api/2021-04/customers/${i}.json`;
    let data = {
          "password": pass.value,
          "password_confirmation": passConfirm.value
    }
    let options = {
      method: "put",  
      headers: {
            'Content-Type': 'application/json',
            'X-Shopify-Storefront-Access-Token':'94-----------------------------------5c'
      },
      body: JSON.stringify(data)
    }

    fetch(urlPassword, options)
      .then((response) => response.json())
      .then((showData) => {
      // Successful request made
      console.log(showData);
    })
      .catch((error) => {
      // Request failed
      console.error(error);
    });
  }

 

 

Tha answer is 

progress error.jpg 

0 Likes