Change Active User Password Without Reset

Hello,

Is it possible to change the password of an active user in a group entirely via .NET code? I was able to do so for staged users but I’m getting the following error when trying to do it for active users: An imported password may only be specified for a user with status: STAGED. Is there another way I can do this for active users? I’m trying to set up a script that updates Okta users with passwords stored elsewhere outside of Okta.

Hi there. Are you using a particular Okta API call/SDK method? Via Postman I am successfully updating the password of an active user with the following call:

https://developer.okta.com/docs/reference/api/users/#set-password

I am using the following snippet of code to make the update using UserCredentials and then calling UpdateUserAsync:
Okta.Sdk.UserCredentials userCredentials = new Okta.Sdk.UserCredentials()
{
Password = new PasswordCredential()
{
Hash = new PasswordCredentialHash()
{
Algorithm = “MD5”,
Value = PasswordHash
}
}
};
credUser.Credentials = userCredentials;
var updatedUser = await client.Users.UpdateUserAsync(credUser, currentUser.Id, System.Threading.CancellationToken.None);

Ah, I see. You are attempting to use hashed passwords. This is not currently supported for changing the password of an active user. You may be able to utilize Password Import Inline Hooks. Take a look at this thread for more in-depth discussion on this:

2 Likes