
bsog9 (bsog9) asked a question.
I know that this report can be pulled manually as an admin, but I would like to create a report where I am able to see when users last logged into a certain application using the API for automation. From the API documentation, I've tried using List Users Assigned to App (https://developer.okta.com/docs/reference/api/apps/*list-users-assigned-to-application), but the information returned doesn't include Last Login info. How can I extract Last Login info using the API?

Working link: https://developer.okta.com/docs/reference/api/apps/#list-users-assigned-to-application
This link is not functional.
This link is not functional.
Hello Team the link isn't working
If you go to https://developer.okta.com/docs/reference/api/apps and do a page find for "List users assigned", it will take you to the code. There are a bunch of other API examples on that page, as well.
In case anyone is still wondering about this question, getting the last login can be done via an API query for the latest app login event matching the user ID and target app ID. You'll want to use the following query parameters:
Don't ask me why this particular filter parameter is the only place in all of Okta where the Event Type property is named event_type instead of eventtype. Just be aware that it won't work without the underscore in there, so if you're getting zero results that may be why.
The "published" property in the response will give you the UTC time of the user's last login to the app.