Okta Workflows Tips #106: Calculate When an Okta User’s Password Expires

Short and handy Okta Workflows tips and tricks. Read the full series.

To find out when an Okta user’s password expires, calculate it from two values:

  • passwordChanged: when the user last changed their password. Itโ€™s on the user object.
  • maxAgeDays: how many days a password lasts. Itโ€™s in the password policy at settings.password.age.maxAgeDays. Get it with the Okta – Custom API Action: GET /api/v1/policies/{policyId}.

Use the Date & Time – Add card to add maxAgeDays to passwordChanged. The result is the expiration date. To get the days left, use the Date & Time – Difference card with the expiration date as the end date and the current time (from Date & Time – Now) as the start date.

A few things to keep in mind:

  • This works for users whose passwords are managed by Okta. For Active Directory or LDAP users, the directory controls expiration.
  • If maxAgeDays is 0, passwords never expire, so thereโ€™s nothing to calculate.
  • If you have more than one password policy, make sure you use the one that applies to your users.

Okta Workflows resources

Leave a Reply