Recommended way to link users, without using the extension

Our application is using passwordless email and social Google login.
My objective is to seamlessly link the users on sign-in.

What is the recommended solution to this? The account linking extensions is not an option, because I would like to avoid the GUI.

I developed a rule that looks for users with same e-mail, and links the 2 if it finds any. The rule itself works great, but the universal login process crashes in the process. Second time the user logs in, it everything works. I expect this is caused by the explanation @jmangelo gave here.

But I would like more details about the recommended implementation he proposes. As I understand it he proposes that the client does the linking - but as far as I know I can’t link users with the auth0.js library?

I also found this blog post, but I am unsure if this is applicable here.

In other words, I basically try to accomplish something like this:

But I’m having a hard time accomplishing the part highlighted in red - so any help is appreciated :sweat_smile:

@konrad.sopala can you help me get this question some :heart: I believe this could be very interesting for other developers :nerd_face: