Authorization Series - Pt 3: Dynamic Authorization with GraphQL and Rules

Hi again and sorry for the delay!

You can call your own API from within the rule by first registering the API with Auth0 and then using M2M authorization between your API and the Auth0 rule.

Here are the steps to do that:

And then once you’re able to connect to your API and grab the role you want to add for the user that’s signing in, you can add it to the access token like this:

This sample shows a similar setup, but instead of grabbing querying the API, it’s pulling straight from the database. Just an example of how both steps can work together!

https://auth0.com/rules/add-roles-from-sqlserver

Let me know if that helps!

2 Likes