I have a question regarding a single-page-app and 2 db connections. Here is the scenario:
I have one db-connection for standard “email” logins and another db-connection for “username” logins. Both are used for separate groups of people.
Creating the db connections and testing them within the auth0 dashboard worked fine.
Upon sign-up, I want to be able to:
a) assign a specific role
b) select which db-connection to use for the registration
Upon sign-in, I want to be able to:
a) select which db-connection to use for signing in
Ideally I would continue to use the central auth0 login. Each user-group has their own login-button in the lSPA.
I have read about using rules, hooks and connectionResolvers to solve this but I am still unsure what to use for my use-case. Also, do I understand it correctly that my use-case is only possible with the classic universal login?
No, there will be no overlap in user bases. In fact, I will be able to distinguish between them pretty well according to their email addresses.
Basically the two user groups have an adult/kids relationship. In other words, the adult has to create an initial account and then he/she can create the kid’s account via our backend API, that will in turn register the kid-user with auth0. Kids do not all have an email address so we do not want to require that. In order for it to work with auth0 we will just give the kid one of our own email addresses as it is a mandatory field. The kids’s email address will otherwise be used for nothing though.
The kid can choose any cool username it wants.
Yes, we can have both user-groups in the same connection, anything that works. Theoretically we could just enable username for both and then register the adults with an email address as username. I did also have different password-strengths configured for the two but we can leave that out if necessary.
Thinking about it, there is one other setting that we will need to separate between the two. Adults should see a sign-up link but not the kids as the adults should take care of that via our API.
To be honest, I do not mind at all which solution we will use in the end. We just need something that works. A simple solution would be a nice bonus of course but I have the feeling that this will be slightly more complicated.
Are the adults and kids using separate apps/login pages? It sounds like they are.
If so, then you CAN use two connections, you just specify the connection in the app: the adult app will use the adult connection and the child app will use the child connection.
Otherwise I’d recommend using a single connection, and leveraging rules and metadata to achieve your ends.
The app is the same but there is a separate button for each type of login. The buttons are both on the same page in the header.
Otherwise I’d recommend using a single connection, and leveraging rules and metadata to achieve your ends
Ok, I suppose the only option would then be to have both groups login via a username. Would I be able to remove the sign-up link for only one of the two if I did that?
Would your suggested solution work with the new universal login, the classical login or would we need to do the login and registration in our app. I don’t mind either as long as we have a solution.
Even though it is one app, create two apps(clients) in the dashboard.
For app Adult, only enable the adult connection.
For app Child, only enable the child connection.
Then ULP should just do the right thing for you (whether classic or new).
Your buttons will need to start the ULP process with the right client.
Thanks very much for you time! That sound like a viable solution - I’ll give it a try. I’ll just have to find out how to separate my global Auth0Provider (as provided in the Auth0 React-SDK examples) for the 2 buttons (both located next to each other in the header):