Reset the User’s password using their existing password.
Note that a successful password reset via an existing password will revoke all active sessions for the user_id.
Reset the User’s password using their existing password.
Note that a successful password reset via an existing password will revoke all active sessions for the user_id.
const stytch = require('stytch');
const client = new stytch.Client({
project_id: 'PROJECT_ID',
secret: 'SECRET',
});
const params = {
email: "sandbox@stytch.com",
existing_password: "old_password",
new_password: "xuEvs9sBi8I4x8rCXJPZ",
session_duration_minutes: 60,
};
client.passwords.existingPassword.reset(params)
.then(resp => { console.log(resp) })
.catch(err => { console.log(err) });
{
"status_code": 200,
"request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
"user_id": "user-test-16d9ba61-97a1-4ba4-9720-b03761dc50c6",
"session": "{...}",
"session_token": "mZAYn5aLEqKUlZ_Ad9U_fWr38GaAQ1oFAhT8ds245v7Q",
"session_jwt": "eyJ..."
}