I have users with roles assigned to them, and I want to get those roles in the rules.
but when I try to get app_metadata I don’t get anything there - like there are no roles.
Also when looking in the user dashboard - it looks like both app_metadata and user_metadata are empty.
That is correct, the roles assigned to a user using that feature (core authorization) are not part of the user’s profile. To access that role data you need to use the management API:
If you mean create your own list of roles in app_metadata, you can certainly do that. That is how we are managing role data today where I work. I suspect we will migrate to the new core authorization feature in the future, but our needs are pretty basic (we have only a half dozen or so roles) so we just maintain them in app_metadata as a list:
Thanks!
yes, this is what we planned on doing. The only downside to this is that there is no UI dashboard to see which users have which roles (we will have 2 roles probably…)
That is an issue for us as well. Since the Delegated Administration dashboard does not currently expose user or app metadata, we are planning to create our own user management UI for our support teams to use that does make metadata accessible to the support teams in some fashion (not direct editing of the JSON!)
Just wanted to add that the user’s assigned roles are available in context.authorization.roles in the rules context. You use that data to then add the roles to the tokens (with context.accessToken with a custom claim).