Auth0 Home Blog Docs

Auditing user events and logging into backend database

auth0
management-api

#1

Hi Team,

I need an expert advise for doing an API call from Autho.Scenario is explained below :

  1. We are using auth0 login and password reset pages for user specific functions like login and password reset.
  2. We are having many users in auth0.
  3. For each users login , logout, password reset, password failure activities, we need to track the events and insert into our application database.

I could find many suggestions like webhooks, rules and hooks.
Could you please help me with the best practice for handling this?

Many thanks in advance.


#3

:wave: @shilpa.c.kumar we could possibly use the Management API v2 to retrieve log entries. Depending on the information we can we can use either the /api/v2/logs endpoint where we can retrieve data based on search criteria, match the provided search criteria or the /api/v2/logs/{id} endpoint which retrieves entries based on a certain ID.

So, for example if we wanted to retrieve by the “Success Login” event, we could specify for the q parameter: q=type:s so our request URL would could look something like: https://" + auth_domain + "/api/v2/logs?page=" + str(x) + "&per_page=100&sort=date:-1&fields=date,type,user_name&include_fields=true&include_totals=true&q=type:s

Can you let me know what you have explored and what you are looking to do in particular?

More information can be explored here:


#4

Hi ,

Thanks for explaining the scenario.My requirement is as below.

If we go to “users” tab in auth0. And take “history” tab I can see “events” listed over there.Almost all the logs which I require for a particular user are listed there. Is there any way to input those events , especially email id and event name ,to a Java API. So that I can save those details to our database via Java API.

Many thanks in advance.

Thanks,
Shilpa


#5

Thanks for the follow up! Would the Get Log Events function in our Java library be what you are looking to achieve : https://github.com/auth0/auth0-java/blob/master/README.md#get-log-events we pass the user ID we can get their event logs.


#6

Thanks Kim for explaining the scenario.
Is there any real time functions like rule .For example : If user logins into auth0 and do a password reset in auth0 page, i can trigger some api functions and can trigger my JAVA API?

I found post registration hooks will trigger event only invite for registration happens. I need the same for login and password reset. That happens only after registration.
:frowning:

Can you please help me?


#7

:wave: @shilpa.c.kumar at this time I am not aware of a hook or a rule that can be triggered upon a password change request. I believe there is plans to implement this, but I wouldn’t have an estimate on when this could be available. Rules will be triggered upon successful authentication, so if there was some functionality you wanted to implement once a user authenticates we could use a Rule to accomplish this.


#8

Thanks Kim for explaining the scenario. I used web hook authentication api extension for serving my purpose and found that its working as expected.