Change Password Skip to main content
How satisfied are you with the Okta Help Center?
Thank you for your feedback!
How satisfied are you with the Okta Help Center?
Very Dissatisfied
Very satisfied
Enter content less than 200 characters.
Ask Search:
Patrick CesardPatrick Cesard 

Change Password


I am looking for a method in the Okta SDK for .NET that allows for changing a password without the need for an API token. Is there such a method? So far the only method I found is the UsersClient. ChangePassword Method  which requires a User object as a parameter. But a User can only be retrieved using the API token, afaik.
Patrick CesardPatrick Cesard
More details on my question:

I'm basically looking for the .NET SDK equivalent to the following link you see when you authenticate (Primary authentication) and the status comes back with "PASSWORD_EXPIRED" and a stateToken.

The API authn/credentials/change_password in the link below, allows you pass in the stateToken and so the API token is not needed:

"_links": {
    "next": {
      "name": "changePassword",
      "href": "",
      "hints": {
        "allow": [
Wils DawsonWils Dawson (Okta, Inc.)
Hi Patrick,

We don't want to support changing a password without an token because that would mean anyone could change your password! The state token is short lived ( and is tied to the transaction from the client, so it provides assurance that the client is allowed to change their password when it is expired.

Unfortunately, looks like we don't yet support this in our .NET SDK. Our SDKs are something we're always improving and bringing up to pairity with our API features that get released, so we will add it, but you can write it yourself and contribute to the SDK on GitHub ( to use it sooner! What you'll need to do is implement this transaction in the docs (

An alternative work around might be to make a call to the set password endpoint ( with an admin token. I'm not sure how that would work in the middle of the authentication transaction though, so you may want to test that out before going too deep there.

Hope that helps!
Patrick CesardPatrick Cesard
Thank you Wils. The first method is what I was thinking of, using the stateToken instead of an API token, which is safer way to go because it is short-lived as you mentioned. I think the way to go in .NET would be to use the AuthClient.Execute Method ( but I wish it was better documented: there's no guidance on how to build the parameters that need to be passed in the method.
Wils DawsonWils Dawson (Okta, Inc.)
Yeah I think that makes sense Patrick. The documentation is definitely something we're working on!
Patrick CesardPatrick Cesard
Thx Wils.
Question about the state token ( The API doc reads:
The lifetime of the state token uses a sliding scale expiration algorithm that extends with every request. Always introspect the expiresAt property for the transaction when making decisions based on lifetime.

How long after I call the aforementioned AuthClient.Execute method to make the password change, will the token expire? Should I specifically expire it to be safe?
Wils DawsonWils Dawson (Okta, Inc.)
I believe it is a one time use code, so after you make the request, you shouldn't need to expire it manually. I think what that documenation is trying to get across is that you should check the expiresAt property before calling Execute to ensure the state token is not expired yet.

Make sense?
Patrick CesardPatrick Cesard
Yes, thx Wils.