I am trying to expose the google user account groups collection to our app.
When I inspect the users “Raw Json” I see
"groups": [
"Some Group"
]
But I cannot appear to get this to be added to the details sent to our app.
I have a Rule that does
function (user, context, callback) {
var namespace = 'http://our.auth0.com/claims/'; // You can set your own namespace, but do not use an Auth0 domain
// Add the namespaced tokens. Remove any which is not necessary for your scenario
context.idToken[namespace + "groups"] = user.groups;
context.idToken[namespace + "test"] = "test";
callback(null, user, context);
}
but both “test” and “groups” do not show up in the JWT.
It looks like this may be because you are using an Auth0 domain.
I tested it and was not able to get the claims in my token with this rule. Changing to a non-auth0 domain fixed it for me. Take a look at this thread for more detail: