Change the authentication method in the middle of the process

First of all, I apologise if my English is wrong.

I am currently working out the requirements for a system that authenticates between two systems.
In this context, the authentication method must be switched.
The first time I log in, I want to use the magic link; the second and subsequent times I log in, I want to use my email address and password.

The reason for choosing this approach is that the two systems are developed by different companies.
Our system can send an email to the customer on the first login, but cannot redirect them to the Auth0 login screen. Therefore, we want to use Magic Link for authentication. After the user steps on the magic link, we want them to set a password.

How can I switch the authentication method based on the number of logins in this way?

Hello there @ito.yu welcome to the community!

Thinking out loud here, but perhaps you could use a magic link on first login, at which point you would also create a user in a database connection with user.email_verified parameter set to false. On subsequent logins use some logic to check login count (see event.stats) in an Action, and then send a password reset link to user so they could set their password/login - This would allow the user you created previously to be “verified”. The only issue I see here is that this would leave you with 2 users, 1 in the email (passwordless) connection and one in a database connection (password). It might also be worth looking into account linking as option if you were to explore this route.

Please note that I have not tested this myself, but hopefully this gives you some options to explore :slight_smile:

1 Like

Hello, @tyf .Thank you for taking the time to reply.

Thanks for letting me know about getting login counts by action and using the reset link.
I’ll try a few things myself based on the information you’ve given me.

Thank you also for the information about account linking. This is useful information as I was just struggling with the requirements regarding account linking.

1 Like

No problem, happy to help where I can! :slight_smile:

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