Password change problem 404 error

good morning my problem is the following this is my code

 const changePassword = () => {
    const url =
      "https://dev-elbuensabor.us.auth0.com/dbconnections/change_password";
    const clientId = "";
  
    const data = {
      client_id: clientId,
      email: "",
      connection: "Username-Password-Authentication",
    };
    fetch(url, {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      body: JSON.stringify(data),
    })
      .then((response) => response.json())
      .then((data) => {
        console.log(data);
      })
      .catch((error) => {
        console.error(error);
      });
  };

When I go I want to give my password change button. It gives me a 404 error.
or
act_devtools_backend_compact.js:2367 SyntaxError: Unexpected token ‘W’, “We’ve just”… is not valid JSON

Hey @hugo127sanchez, the Authentication API /dbconnections/change_password endpoint does not return a JSON response - you should be able to fix your function by changing response.json() to response.text().

The response you should see in your console.log afterwards is: We've just sent you an email to reset your password.

Hope this helps!

1 Like

Thank you very much for the reply. I made the change and it worked!

1 Like

Teamwork makes the dreamwork!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.