Assigned roles to users (using Authorisation Core)
Despite following these steps, the roles are not available in Actions or Rules. I’ve tried the following samples for Actions and Rules. Oddly, the test suite for Rules shows the correct roles on the user object .
I understand that you have encountered a situation where the Roles assigned to users are not available in Actions or Rules.
After my investigation, I was able to successfully get the user’s assigned Roles using a Post-Login Action.
Moreover, the samples you followed for Actions and Rules is correct for appending the user’s assigned Roles to an ID Token.
In this case, could you please use the Real-time Webtask Logs Extension while testing your Post Login Action script to see if you can print the user’s assigned roles. For example:
Thanks for sharing this tip on debugging - it helped me find where I had gone wrong. The roles array was initially empty in the logs:
7:14:38 PM:
new webtask request
7:14:38 PM:
The assigned Roles are: []
7:14:38 PM:
finished webtask request
Previously, I had applied roles directly to users, and not within the context of an organization. When I applied a role to a user in an organization context (steps in the Management Dashboard: Organization > Select an org > Members > […] Assign Roles), the roles array was populated.