Exposing Google user accounts groups

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.

What am I missing here?

Hi @hez,

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:

Please let me know if this works.


Worked like a charm! Thank you for the help!

I’m glad it worked for you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.