Auth0 Home Blog Docs

Permissions in token pulled from Sql Server?

I can pull our Roles from Sql Server and stored them in the token via a rule, see below:

{
  "https://somethinghere:auth0:com/roles": [
    "Site Administrator"
  ],

  "permissions": []
}

However, I want this stored in the permissions[] array (note, our Roles are really just your permissions) like this:

{
  "permissions": [
      "Site Administrator"
   ]
}

But I can’t figure out how to write to the permissions array in a rule?

I need to be able use this in C# controllers with the [Authorize] attribute like this

[Authorize(Roles ="Site Administrator")]

Hi @mike.griffin1,

Unfortunately I don’ think you will be able to access the permissions array in the token, as it is supposed to be a reference to the API permissions configured in the dashboard.

This thread talks about it and shows how to use custom claims to form a solution. Please let me know if you have questions.

Hope this helps!

Thanks,
Dan