Account Linking Not Occurring On User Creation

Problem statement

When using a rule to link accounts based on having the same email, users created via API are not getting linked even though another account with the same email already exists.

Cause

Rules do not run when users are created with the /api/v2/users endpoint of the Management API.

Solution

The account linking for users created via API can either be done through the rule when they log in for the first time, or through the Management API after the user has been created.

Related references