October 24 Auth0 Community Ask Me Anything: Tailor Your Experience with Universal Login — From Low-Code to Pro-Code

How to automatically create a new organization for a new user who just signed up using Universal Login?

The ideal flow: user first login → action creates org → login flow resumes, user picks org → user authenticated and org_id on token.

Background:

We have an application that requires Business Users. So, every user has to have an ORG. Currently, we have to create a new ORG manually in Auth0 for every customer and then invite their users. When the users try to sign up themselves, they get an error message: “You are not a member of any ORG.”

We would like to streamline the onboarding experience and let users sign up on their own using different connections: Google, Microsoft, and Auth0 Database. But for that, we have to create ORG for each of them right after the sign-up (or first login in case of social connections) but before the sessions are issued. So after that, the user has the new ORG ID in their JWT token, and our app can work with it.

How can I create a new ORG in the action and add its ID to the org_id in the token?

I’ve struggled with this a lot, but unfortunately, I haven’t found a way to do it:

  1. I’ve tried to create an ORG in actions on Post Login, but the new ORG ID is not present in the token as org_id. Exactly as described here: Create and use organization on first login
  2. I’ve tried to creat an ORG on Pre User Registration and Post User Registrations. But it does not work with social connections as these events are not triggered for them.
  3. I found that on your Saas Start template, you somehow use two Auth0 applications to let the user create a new ORG on the first login. But I haven’t figured out how it works.
    a. SaaStart Management (Types of Users: Individuals)—To log in a user for the first time without an ORG, let them create a new ORG and somehow switch to the second app, which requires the user to give an ORG.
    b. SaaStart Dashboard (Types of Users: Business Users) - to continue using the app.

Question unrelated to the Universal Login:
Can you please explain the approach (3) you use in the Saas Start template?