Account linking using Action during Post User Registration

Hi everyone,

I’m trying to implement a seamless account linking routine, but still without success, although I’ve found some success stories from the community like the one from Alexab.

I’m doing the whole process using an Action during Post User Registration flow, and the code can be consulted in this repository on GitHub. I wrote this integration test, and I could manually assert that the logic was working as expected. To test it manually, I created two users with the same email address, then executed the test. So far, so good!

Before linking:

After linking the accounts (the linked account shows 2 identities in its properties):

The problem appeared when I started a database from scratch and created the two users, testing the Action on Auth0 instead of doing it locally. When I make the second user during the registration flow, I receive the error The user does not exist.

Testing it locally with a small express server with the help of Ngrok and Axios to invoke my endpoint, everything seems fine, but the Management API returns the same error.

My test case:

  1. Create a user using email and password, and then authenticate it.
  2. Confirm user’s email.
  3. Log in using passwordless with the same email from the user at step 1.
  4. The Action is called, and the error The user does not exist is raised.
  5. Enter the provided code that had been received by email.
  6. Authentication flow is finished.

It seems that between steps 3 and 4, the user is not entirely created in the database (is it waiting for the code confirmation?), though I could receive his ID in the Action.

7 Likes

Hey there!

As this topic is related to Actions and Rules & Hooks are being deprecated soon in favor of Actions, I’m excited to let you know about our next Ask me Anything session in the Forum on Thursday, January 18 with the Rules, Hooks and Actions team on Rules & Hooks and why Actions matter! Submit your questions in the thread above and our esteemed product experts will provide written answers on January 18. Find out more about Rules & Hooks and why Actions matter! Can’t wait to see you there!

Learn more here!