
servicea.28287 (Customer) asked a question.
Hello, everyone. I have a requirement to indicate the number of retries left for successful sign in. After three failed login attempts, the user's account will be locked. If I type the erroneous password for the first time, it will indicate two attempts remaining, then one attempt remaining, and then the account will be locked. As far as I can tell, OKTA has no API that can return the number of failed login attempts. I tried using the logs API and it worked perfectly. However, I'd like to add a filter for fetching logs from the last 30 minutes, so that I can count unsuccessful login attempts from the logs and add logic to the UI. Please consider the following curl:
curl --location --request GET 'https://singlife.oktapreview.com/api/v1/logs?limit=3&filter=legacyEventType eq "core.user_auth.login_failed" and actor.alternateId%20eq%20%22%2B9182xxxxxxxx%22 and outcome.reason eq "INVALID_CREDENTIALS"' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: SSWS {}' \
--header 'Cookie: JSESSIONID=6CC2E2E5830F252BE4C2C366D62B931F; JSESSIONID=A3726D58DC05E5BABDD9536822918398'

Hi @servicea.28287 (Customer),
Thank you for posting on the Okta community page!
I have done some research on my end and I found that it is possible to use a query to filter the API call to show events only from a certain time frame. I have provided bellow a documentation about parameters that can be used for the list API call:
I hope the above information is helpful!