Add enterprise user on first login as member to org

Hello

To add new members to an org the flow we want is:

  • a customer admin application used to invite enterprise user (not using auth0 invite).
  • Will send an email containing login url that includes the users organizationId
  • user clicks login link, authenticates through their orgs idp. auth0 creates a user
  • a post-login action then attempts to add user as a member to organisation.

I’ve tried based an action similar to this post Is there a way to add a Social Login user to a role or org before they sign in the first time?

BUT when user logs-in receive failed login error that user not part of organization. The user account is created but not added as a member. I’m confused how that post I linked to works in this case.

Note organisation with auto member enrolment is disabled as we don’t just want any one being added as a member.

Is there a way to implement this without using the auth0 invite flow?

Thanks