Reset/Change a Password

We are going to take a quick look at manipulating the currently logged in user’s password. There are two examples of how to do this displayed.

For more information on Users, Reset Password Requests, and the methods used please look at UserInfo and ResetPasswordRequest.

Reset Password

The first is a password reset. The password reset takes in the old password and the new password. It only works on the current user.

Reset Password

Example in C#

await client.ResetPasswordAsync("OldPassword", "NewPassword");

Example in CURL

curl -X PUT \
  https://keepapi.feenicshosting.com/api/currentuser/resetpassword \
  -H 'Authorization:  Bearer TOKEN_GOES_HERE' \
  -H 'Content-Type: application/json' \
  -d '{"$type":"Feenics.Keep.WebApi.Model.ResetPasswordRequest, Feenics.Keep.WebApi.Model","OldPassword":"OldPassword","NewPassword":"NewPassword"}'

Change Password

The second is a password change. This method should be used with caution as it will force a password change on the provided user, in this case the current user. This method will also send an alert to the user that their password has been changed and will provide them with the new password.

Change Password

Example in C#

var userInfo = await client.GetCurrentUserAsync();
await client.ChangePasswordAsync(userInfo, "NewPassword");

Example in CURL

curl -X POST \
  https://keepapi.feenicshosting.com/api/f/INSTANCE.KEY/users/USER.KEY/password \
  -H 'Authorization:  Bearer TOKEN_GOES_HERE' \
  -d '"OldPassword"'