Single application but different organisations/clients - how to manage in NextJS

Hi,

I’m looking for the best way to do the following (I’m using the NextJS SDK, the beta version):

  1. Login to my application and pull ‘groups’ or ‘metadata’ of the user.
  2. Map to said data

Basically, I’ve got an application where my backend has a whole heap of different customers in a single database. I want to specify logins per customer and have them route to the correct data within the database - I was going to simply use app_metadata or organizations etc., but I’m not sure what the best method is.

I tried using both, but I was completely unsure on how to actually get that data be accessible when the user logged in - I tried pulling the ‘user’ objective from useUser, but there’s nothing usable there other than:

nickname, name, picture, email, email_verified, sub

How can I simply add an extra hook into my logged in user? And how can I scalably configure this within auth0?

I feel like I’ve worked out a way where I could use post-login actions to go and fetch this data from some external database but that just seems like a lot of overkill; can’t I configure this within auth0?

Thanks

Hi @kevin.robertson,

Does your application have two different URLs for two different types of users with the same API, or will both users use the same application URL?

Thanks,

Hi @kevin.robertson ,

If you have two different URLs for the application, you can use the organization feature. If you have the same URL, you can use organization roles (two roles within the same organization). Let me know how your application works, and I can help you set it up.

Thanks