How to know when it is a user's first login

I’ve been trying to assign users unique guids upon sign up to my app via Auth0. To do this I’ve created a post login action that generates a UUID and stores it in the user’s app metadata when login_count == 1. This works for the most part, however, I’ve recently noticed that in some cases UUID’s weren’t being assigned and from investigation I believe its because login_count increments even if login fails due an error with one of the post login actions. This means that if an action before my post login action for assigning UUID fails, the logic_count will increment above 1 so when the user retries signup, login_count == 1 = false and a UUID is not assigned.

Is there a better way to know when this is the users first successful login? Or is there a way to run an action upon all successful signups? From reading the documentation, the pre and post user registration flows don’t cover all authentication flows e.g. users who sign up via social provider don’t hit the pre or post user registration flow?

Hi @andyphynes

Welcome to the Auth0 Community!

Thank you for posting your question. As you said, another option would be to use the Post User Registration Action, but it’s only available for Database and Passwordless Connection types. If your users use social connections, the most efficient way is as your post describes.

If you are having an issue with action debugging, you can try to use Real-time Webtask Log Extension → Real-time Webtask Logs Extension

I hope it answers your question!

Thanks
Dawid

1 Like

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