I recently setup a new Auth0 connection database, configured as a “custom database” with automatic migration turned on. This works great – upon initial sign in, it reaches out to my legacy SQL user store and migrates it over with the proper id, password and metadata.
I’m at a loss as to how I can, at the point of migration, assign an Auth Core Role (for RBAC) to the user based on their profile from SQL. I have turned on “Add Permissions in the Access Token” - so the goal is to have the permissions for the assigned roles be populated in the initial access token.
What I’ve tried:
rolesarray under both the
user_metadataobjects, knowing there was no reason this would work
Creating a rule to read the user’s role out of
app_metadataand assign it to the real role system via the Auth0 Management Client. This does add the role, however the permissions do not appear until the subsequent login.
Creating a hook to do the same as above, but it doesn’t solve the problem. Not only do the hooks not seem to trigger on the migration event, but the lifecycles don’t match up - either the user doesn’t exist yet (pre-creation) or it happens async outside of the login process.
Any ideas? Anything simple I’m missing that would allow me to pull this off?