I've implemented custom signup, signin and signout and I'm trying to reset password but all I found is how to send a reset password email to the user and nothing after how to reset password.
PS : I don't want to use auth0-lock or auth0 widget
If you want to update an user's password by code, you can do so by using Management API v2.
You will need to "update" the user by using the PATCH verb to this resource:
https://{account-domain}/api/v2/users/{user-id}
and a body like this:
{
"password" : "new_password",
"connection": "the_connection_to_use"
}
You will need a bearer token for this, that you can generate from the Management API v2 documentation page.
An equivalent CURL command (new lines added for readability):
curl -H "Authorization: Bearer {your access token}"
-X PATCH
-H "Content-Type: application/json"
-d '{"password":"new_password","connection":"the_connection_to_use"}'
https://{account domain}/api/v2/users/user-id
Keep in mind that if the end user will trigger this you should also implement a mechanism to validate the user's identity, such as having the user log in in first (if he or she remembers the old password) or by sending an email with a link to start the process.
To reset the forgot password you can use the 'changePassword' method available in Auth0 library by passing only email id.
Following snippet is how we reset password(custom) using auth0-angular.
function reset(username){
angularAuth0.changePassword({
connection: 'Username-Password-Authentication',
responseType: 'token',
email: username,
}, callback);
}