How to recognise if actual login event took place

Hello,
We need to be able to log when a user had to actually log in with the login form. We have angular app with Auth0 sdk and for analytical purposes we need to know wheather there was an interaction needed from a user while opening the app.
We thought the callback component would be the good place to log that event be now it seems the browser is always redirected to a callback url, even when there is a valid session and silent authetication works.
How can we achieve that?

For every step/ action, Auth0 publishes an event. For Login it would be of type “s”. If you enable the event stream and listen-in to it, you would exactly know when the user signed-in.

Is that helpful?

2 Likes

Thanks for the answer @narayanak!

+1 on @narayanak’s answer, but also note that although there are Successful Login “s” type events in the tenant logs, the user may have a valid session already in Auth0 and be automatically redirected to the callback page without any interaction on the Universal Login page (assuming prompt=login is not being used in your /authorize URL to force re-authentication)

If you 100% need to know when user interaction occurred for analytic purposes (i.e. the user needed to enter email/pw or chose a social login option), then you must ensure a connection and connection_id value exists in the “s” log event.

For example:
A user who chose to login with Google social connection

{
  "date": "2023-06-21T13:10:08.012Z",
  "type": "s",
  "connection": "google-oauth2",
  "connection_id": "con_XXXXXXX",
  ...
  ...

vs

A user who had existing valid Auth0 session and was automatically redirected to the callback url

{
  "date": "2023-06-21T14:50:01.392Z",
  "type": "s",
  "connection_id": "",
  ...
  ...

(Note that there is no connection parameter here)

2 Likes

Thanks for expanding @gparascandolo :heart:

Thanks a lot for all the answers.

Are you talking about server sent events? How should I enable “the event stream and listen-in”

I think you are looking for Log Streams.

ok, but I need to do it in the Angular app. Does the SDK provides that?