Getting user's most recent logins paginated with location_info

I am trying to retrieve the most recent successful logins of a user, annotated with the geographic location where the user logged in from, preferably in a way I can get easily paginated. All the functionality appears to exist, but not in one place. I run into the following problems:

My solutions seem to be:

  • Use the /api/v2/users/{user_id}/logs endpoint, and manually filter by type=="s". However, this breaks any reasonable attempts at pagination of results (so that a script/UI I build on top of this can get the next logins) and/or requires me to manually use Auth0’s pagination to find sufficient number of “type:s” entries intermingled with other user logs (e.g. if I’m trying to get the last 5 successful logins, I may have to go through many pages if many other operations occurred in between).
  • Use the undocumented ability for the /api/v2/users/{user_id}/logs endpoint to take q=type:s as a parameter. This is exactly the functionality I want, and this apparently works already (I tried it by modifying a call to curl to add this query parameter). However this is not documented in the API docs for v2, nor is it supported in the official Auth0 Python client. I see Migrate to Tenant Log Search v3 makes reference to a q field possibility for /api/v2/users/{user_id}/logs, but it’s unclear if that was only available in v2.

So my questions are…

  • Is there any plan to official support the Lucene query string parameter (as documented in Log Search Query Syntax) for the /api/v2/users/{user_id}/logs endpoint?
  • Is there any way to populate the location_info field if using the /api/v2/logs endpoint?
  • Or am I stuck manually paginating through every kind of user log just to extract fields of type:s to get both pieces of info at the same time?

(I know a longer term solution would involve us streaming the logs and performing the queries on our own indexes, but the pieces already seem to be there on Auth0’s side without us having to set up our own infrastructure for this.)

2 Likes