I am trying to sync a password from a source to Okta using the Okta SDK dotnet.
I can preform this using a HttpRequest client.PutAsync however i would rather use the Okta API endpoint for the SDK. Does anyone have any C# code samples they can share with me to complete this?
(https://developer.okta.com/docs/reference/api/users/#set-password)
Hi,
You should call UpdateUser method and pass it an “empty” User object with populated Credentials:
User credUser = new User();
Okta.Sdk.UserCredentials userCredentials = new Okta.Sdk.UserCredentials()
{
Password = new PasswordCredential()
{
Value = newPassword
}
};
credUser.Credentials = userCredentials;
var updatedUser = await _oktaClient.Users.UpdateUserAsync(credUser, userId, CancellationToken.None);