Assigning User roles on Custom Database action script

How can i assign a role when creating a user through custom database action acript ?
When users try to login first I’m checking if they are already in the auth0 database and if not, I’m authenticating them against a 3rd party idp(AWS cognito), and upon successful authentication i then transfer this user to auth0 for future login requests. this works well, I can assign user_metadata and app_metadata by adding that to the profile on migrations. But I want to assign an existing custom role in the auth0 when we create this user. How can I do that, I tried passing a “roles” property to normalize profile but it didn’t work. any ideas ?

Hi @dev-support,

Welcome to the Auth0 Community!

Have you tried adding it via the management api? Specifically this endpoint.

Here is an example rule that might be insightful:

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.