How to know last sign-on App via API? Skip to main content
https://support.okta.com/help/answers?id=9062a000000dfnaqaw&refurl=http%3a%2f%2fsupport.okta.com%2fhelp%2fanswers
How satisfied are you with the Okta Help Center?
Thank you for your feedback!
How satisfied are you with the Okta Help Center?
1
2
3
4
5
Very Dissatisfied
Very satisfied
Enter content less than 200 characters.
Ask Search:
Javier MartiJavier Marti 

How to know last sign-on App via API?

Is there any way to know via API the last login for an APP?
Chris HancockChris Hancock (Okta, Inc.)
Hi Javier,

To retrieve the last login for an app you can utilise our events API which is documented here: 
https://developer.okta.com/docs/api/resources/events

Action Object types you will find the required parameters for your search scope. 
However you won't be able to sort the results whereby most recent is displayed firts as such you will need to utilise the published parameter to define a time frame i.e. greater than 1st Feb 2018. 

The following query I used in the Postman application.
{{url}}/api/v1/events?limit=100&filter=action.objectType eq "app.auth.sso" and target.id eq "{{appId}}" and published gt "2018-02-10T00:00:00.000Z"

This will return results 100 results per page and filters based on the application authentication for the target app that occurred after the 1st Feb 2018. 

Alterantively you can use the system log and filter based on the application ID and the event type, this can also be exported to CSV. 

I hope the above information is helpful!
Dylann FezeuDylann Fezeu (Customer First Programs)
Hello,

Thanks for posting your inquiry in Okta Community Portal.

​If you receive a great answer to your question(s), please help readers find it by marking it the best answer. Hover over the answer and click "Best Answer." 

Thank you,

​Dylann Fezeu
OHC Team