Hi,
When I enable this rule in my “staging” tenant, it fail with an “invalid_grant (Invalid authorization code)” error :
function(user, context, callback) {
const namespace = 'https://exemple.com';
if (context.authorization && context.authorization.roles) {
const assignedRoles = context.authorization.roles;
if (context.idToken) {
const idTokenClaims = context.idToken;
idTokenClaims[`${namespace}/roles`] = assignedRoles;
context.idToken = idTokenClaims;
}
if (context.accessToken) {
const accessTokenClaims = context.accessToken;
accessTokenClaims[`${namespace}/roles`] = assignedRoles;
context.accessToken = accessTokenClaims;
}
}
callback(null, user, context);
}
When the rule is disabled, authentification work well. I have the same rule on my “development” tenant and it works fine.
I can’t figure why, every parameters are identicals…
Any idea ?