How to create another user & link with the main after signup via actions?

I’m trying to solve a case where a user would register via social connection, and I’d linke to create a Username-Password-Authentication user with the same email as from registered user and link those two together.

Which action trigger should I use? Post registration? Post login?
Also it’s actually not clear if when user is registered the post login is actually trigerred as well.

How would the code look like for that action? And do I have to return anything? Will the JWT issued be valid after that manipulation?

exports.onExecutePostUserRegistration = async (event, api) => {
if (event.connection.name !== “Username-Password-Authentication”) {
// create Username-Password-Authentication account with same email
// link accounts
}
};

Hi @roman.hrytskiv.m , welcome to the community!

Account linking with Actions is currently a know limitation and will be addressed before Rules EOL.
Right now we recommend using Account Linking with Rules, please take a look at all the information we have about Account Linking and our recommendations, the easiest way will be to utilise the Account Linking Extension.

Please keep an eye on the Auth0 Changelog as this will share updates on when Account Linking becomes possible with Action.

Hope this helps, thanks!

1 Like

Hi, can you clarify, Account Linking with actions will be available before Rules EOL or Deprecation? Because I can see that when Rules will get deprecated (Oct 16 2023) they won’t be available to new tenants, which doesn’t really make sense as this will leave new tenants out of options: no Rules, and no Action Account Linking either.

Hey,
Yes the account linking with actions will arrive before the deprecation in October 2023 :slight_smile:

1 Like

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!

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