Last login date for separate applications in tenant

Hi,
I am implementing a system with several applications attached to one tenant.

I have SSO, Universal Login and all applications with working authorization and authentication using Auth0.
What I want to do is to implement lastLoggedIn date for all applications separately.
For example: ApplicationA, ApplicationB and ApplicationC is given. I want to use the same SSO for all of these apps with same credentials, and I want to store lastLoggedIn date for each apps (for example: 11/11/2022 (for app A) 13/11/2022 (for app B) and 9/9/2022 (for app C)).
I understand that last_login field point date of last logging to Auth0 - such as Universal Login and it is shared across applications.

Is there any possibility to obtain that data from Auth0 user, either from API or callback redirect?
Can it be done by checking what app want to authorize in Auth0 or it have to be done separately from Auth0?

Hi @rga,

Welcome to the Auth0 Community!

Unfortunately, it is not possible to get a user’s last login date for separate applications.

As a workaround, I recommend creating a Post Login Action script where you save the last_login property based on the application they are logging into in the user_metadata.

To do so, you will need to call the Management API in Actions to get the last_login property and then call the api.user.setUserMetadata method to save this value.

For example:

api.user.setUserMetadata(event.client.name, last_login)

This way, you can save the last login date for each separate application and query it in the future by checking the user_metadata.

I hope this helps!

Please let me know if you need any help with implementation or need further clarification.

Thanks,
Rueben

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.