Okta Workflows Tips #105: How to Auto-extend App Access Based on Recent Sign-ins

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

This tip is from Taz Rafiq.

When you grant app access for a fixed time through Okta Identity Governance (OIG), you can renew it only for people who still use the app. A single Okta-Search System Logs card can answer β€œHas this person signed in to this app in the last 30 days?”

Here’s the setup. Access is granted for 90 days. On day 87, a flow runs this check. If the person signed in recently, the flow extends their access with the OIG-Create Request card, with Requested For set to that person. If not, access ends on day 90, and the license frees up.

The Helper Flow takes two inputs, user_id and app_id. A Text-Compose card builds the filter from them. Set the Okta-Search System Logs card like this:

  • Search By: Expression, so you can write your own filter.
  • Custom Filter: The output of the Text-Compose card.
  • Since: Today minus 30 days. Use a Date & Time-Now card, then a Date & Time-Subtract card.
  • Result Set: First Matching Record. One sign-in is enough to answer the question.

The filter looks for a successful SSO sign-in by this person to this app. The success check matters because the event also logs failed attempts:

eventType eq "user.authentication.sso" and outcome.result eq "SUCCESS" and actor.id eq "<user_id>" and target.id eq "<app_id>"

If the card returns a record, extend the access. If it returns nothing, let it expire.

If you leave Since empty, the card only searches the last 7 days. Someone who used the app two weeks ago would look inactive and lose access they still need.

The flow that checks for a recent sign-in
The flow that checks for a recent sign-in

Okta Workflows resources

Leave a Reply