Hello
I’m trying to add a custom claims to OIDC and it seems to be unable to pull from the user.
This is the rule I wrote for it from the guide:
function (user, context, callback) {
const namespace = 'https://myapp.example.com/';
context.idToken[namespace + 'groups'] = user.user_metadata.groups;
callback(null, user, context);
}
Any ideas on how to proceed?
This is the Raw JSON of the USER
{
"kind": "admin#directory#user",
"id": "REDACTED",
"etag": "REDACTED",
"primaryEmail": "cy@borg.dev",
"name": "REDACTED",
"isAdmin": true,
"isDelegatedAdmin": false,
"lastLoginTime": "2019-07-20T15:15:50.000Z",
"creationTime": "2019-03-23T10:56:51.000Z",
"agreedToTerms": true,
"suspended": false,
"archived": false,
"changePasswordAtNextLogin": false,
"ipWhitelisted": false,
"emails": [
{
"address": "cy@borg.dev",
"primary": true
},
{
"address": "cy@borg.dev.test-google-a.com"
},
{
"address": "REDACTED"
},
{
"address": "REDACTED"
}
],
"phones": [
{
"value": "REDACTED",
"type": "mobile"
}
],
"is_admin": true,
"is_suspended": false,
"is_ipWhitelisted": false,
"tou_accepted": true,
"email": "cy@borg.dev",
"email_verified": true,
"given_name": "REDACTED",
"family_name": "REDACTED",
"picture": "https://lh3.googleusercontent.com/-D-Y3z5r6wyU/AAAAAAAAAAI/AAAAAAAAAAA/ACHi3rdRM44-ytY1im6y5jH6ASfaY6nAcw/photo.jpg",
"locale": "en-GB",
"groups": [
"Admin",
"Work"
],
"updated_at": "2019-07-20T22:53:33.790Z",
"user_id": "google-apps|cy@borg.dev",
"nickname": "cy",
"identities": [
{
"provider": "google-apps",
"user_id": "cy@borg.dev",
"connection": "borg-dev",
"isSocial": false
}
],
"created_at": "2019-07-20T21:10:48.253Z",
"last_ip": "90.254.116.32",
"last_login": "2019-07-20T22:53:33.789Z",
"logins_count": 6,
"blocked_for": [],
"guardian_authenticators": []
}