what must be the request body for update password ...
# talk-kratos
b
what must be the request body for update password flow in kratos. When I am making the request it is redirecting me to the same settings page where I am updating password. I think there is some validation erorr which I am not able to findout.
p
Hi @boundless-hydrogen-45841 Please check out this section of the docs https://www.ory.sh/kratos/docs/self-service/flows/user-settings/#update-password
b
hey @proud-plumber-24205 I went through that portion, I am trying to make a form request for updating the password
Copy code
const changePassword = (values) => {
    // values is the content i.e. password
    // ui is the response for settings flow
    var updatePasswordForm = document.createElement('form');
    updatePasswordForm.action = ui.action;
    updatePasswordForm.method = ui.method;
    updatePasswordForm.style.display = 'none';

    var passwordInput = document.createElement('input');
    passwordInput.name = 'password';
    passwordInput.value = values.password;

    var csrfInput = document.createElement('input');
    csrfInput.name = 'csrf_token';
    csrfInput.value = ui.nodes.find((value) => {
      if (value.attributes.name === 'csrf_token') {
        return value;
      }
    }).attributes.value;

    var methodInput = document.createElement('input');
    methodInput.name = 'method';
    methodInput.value = 'password'; 

    updatePasswordForm.appendChild(passwordInput);
    updatePasswordForm.appendChild(methodInput);
    updatePasswordForm.appendChild(csrfInput);
    document.body.appendChild(updatePasswordForm);
    updatePasswordForm.submit();
  };
hey @proud-plumber-24205 that problem is solved. While updating password one has to also pass the email i.e ''password_identifier"
p
@boundless-hydrogen-45841 that's good to hear 🙂 A good tip is to always look at what the error message is when it redirects you back
b
thank you @proud-plumber-24205