Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Insert the groups which starts with a case insensitive keyword into the ID token with an Auth0 rule
function (user, context, callback) {
const namespace = 'https://acme.com/';
const KEY_WORD = "ruler"; // Any groups which start with Ruler is inserted.
function selectGroups(group) {
return group.toLowerCase().indexOf(KEY_WORD) === 0;
}
context.idToken[namespace + 'groups'] = user.groups &&
user.groups.filter(selectGroups);
callback(null, user, context);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.