Hello,
I have been trying for the past few days to get roles into the access token. To be fair, I am about to give up and move to a different provider because it seems to be so difficult, for such a simple thing.
I have tried every rule and action I have come across. I am using Authorization Core instead of the extension.
I have even tried to copy paste this action:
And it still doesn’t work.
I have tried setting dummy claims like this:
api.idToken.setCustomClaim('myClaim', 'this is a private, non namespaced claim');
api.accessToken.setCustomClaim('myClaim', 'this is a private, non namespaced claim');
And still no luck.
This is my current action:
exports.onExecutePostLogin = async (event, api) => {
const namespace = 'https://example.com';
if (event.authorization) {
api.idToken.setCustomClaim(`${namespace}/roles`, event.authorization.roles);
api.accessToken.setCustomClaim(`${namespace}/roles`, event.authorization.roles);
}
};
I have also tried to follow this one:
I have also created an API and use that identity as audience
during authorization but still no luck.
Best regards
Jarl