Hey guys, I’m working on a project to setup a server for my university. It contains a user system (for which I’m using Auth0) where I need to be able to put users into different groups and access that information on my client. I tried solving my problem for 5 hours now, but nothing seems to work. Please keep in my mind that my background is not professional, I would be very glad if you could help me. I’m using Nodejs for my server, accessing auth0 with passport.
Problem:
The requested idToken does not contain the users groups.
I tried:
Scope: I wrote groups in the scope, nothing changed. I keep it there, because I don’t know if it matters for the token. EDIT: Deleted groups in the scope like @kim.maida told me to.
Changed the authorization rule as written in other threads about similar problems. It now looks the following:
// ….
// Update the user object.
user.groups = data.groups;
const namespace = 'https://mydomain.com/claims/';
context.accessToken[namespace + 'groups'] = data.groups;
context.idToken[namespace + 'groups'] = data.groups;
// Store this in the user profile (app_metadata).
saveToMetadata(user, data.groups, data.roles, data.permissions, function(err) {
return callback(err, user, context);
});
// …
Now, when trying the rule with my test user, I get the following output:
{
"https://mydomain:com/claims/groups": [
"Optimierung",
"Admin"
]
}
Instead of
{}
Still, there was no change in the issued idToken.
I also tried other small things, but I can’t remember all of them. Hopefully you guys can help me, I’m growing very desperate.
Edit: I am not using OIDC Dynamic Application Registration.