Enable Self-Service Signup in B2B SaaS

Hi,

I’m looking to enable self-service signup within my multi-tenant application using Auth organizations and Universal Login, but I’m having trouble integrating this with the React SDK. From what I’ve gathered, the best way to accomplish this so far is to use two clients:

  • Application client - The default client used in the React application, where users are authenticated in the context of an Auth0 Organization (“Business Users” login experience)
  • Onboarding client - The is used during the user’s initial signup flow. There is no organization for the user yet, and they are authenticated outside of the context of an Auth0 Organization, then uses the Management API to create one and add the user as a member.

The problem is the onboarding client is handled on the server while the React app requires organization membership to authenticate. Do I create a third application and switch clients in the Auth0Provider?

Any guidance would be greatly appreciated!

Hi @pburr,

Welcome to the Auth0 Community!

Creating a 3rd application to manage a correct redirect should not be needed in this case and it is not the recommended approach. I would advise on creating a separate endpoint on the server side application to redirect the users to after a successful singup in the onboarding client. So when a user registers the redirect_uri for this onboarding flow should point to a server-side endpoint in your application, not directly to your React app. Then your application’s code should

  • Verify the tokens
  • Create a new Auth0 Organization.
  • Add user as a member of the new organization.
  • Redirect to the React App callback’s URL with the organization parameter set in the /authorize request.

Then your React App should receive tokens that include an org_id as well.

I hope this helps and if you have further questions please let me knwo.
Thanks,
Remus