Invitation email, but user already exists?

Preamble

I am creating an app that has organizations, which have users, sort of like Github. Where each user can belong to multiple organizations, and thus see the private data stored in that org’s repos.

I want to allow users to invite other users to their organization. It sounds like this is possible by following this post, which creates an auth0 account for my auth0 app sends the user essentially a password reset email.

Question

However, what should I do if the user already exists in that app, as a member of a different organization?

My first guess

Basically, I am thinking I need a simple if statement in my app logic:

  • the inviting user types in the new user’s email
  • if that email doesn’t exists in my auth0 app
    • follow the auth0 invite workflow above
  • if that email already exists in my auth0 app
    • send email or notification via some totally separate workflow that doesn’t involve auth0
    • once accepted update my DB records accordingly

Has anyone faced a similar issue?

Any thoughts would be welcome :slight_smile:
Thanks!