I’ve been making a ASP.NET Core for a while and had troubles with Identity. Ended up finding Auth0 and seems like it was just what I was looking for.
I have a few doubts though:
Can I use the user ID and add it to a custom Azure DB, in order to tie other user properties? For example, I want to use Auth0 for authentication and such, but I want to manage other user properties in Azure SQL, let’s say a list of games tied a user. Is this possible with Auth0?
Regarding if that is possible, can I have different roles in order to have an admin CRUD those list and modify user lists?
You’ll end up having a user present both in Auth0 and Azure DB databases. You can save Auth0’s user id in Azure DB (as an unique string) and/or use Auth0’s user profile app_metadata to store Azure DB’s id. I do both.
To do so, I use a rule on Auth0. On each login, I check Auth0’s user profile for a specific property. If it is present, then the user already exists in my Azure DB and logins continues normally. If not present, I call my backend (from the rule) to create a new user and get back Azure DB’s id. I then store it as a property in app_metadata. So on Auth0 I have a login rule, on the backend I have an API endpoint which gets the Auth0 id, creates the user on Azure’s DB and returns back the new user id.
At the end, I have a double reference so in Auth0 I know the id of the user on my backend, and on the backend I know the Id of the user in Auth0.