Organizations is not supported together with primary user modifications in rules

I’m trying to link an account with a post login trigger automatically where I check the existing user with email and link users who have an existing identity. The linking works as expected but when I call api.authentication.setPrimaryUser I get an error saying Organizations is not supported together with primary user modifications , I guess this is because we have enabled auto-registration in one of our organizations.

Reference flow:

  1. Existing user via database connection belongs to ABC organisation
  2. New user = with same email via google connection now belongs to both ABC + Org1 (auto-membership organisation)
  3. Action linking works but returns an error of Organizations is not supported together with primary user modifications when login flow is completed hence, login fails at the end.
  4. It does work as intended on the second login
1 Like