I am using the following Rule script to try and push identity information into my access token. I have the logging code included temporarily to verify that there are values for these claims.
function (user, context, callback) {
const namespace = 'https://mydomain.com';
let accessTokenClaims = context.accessToken || {};
// temporary
console.log('Name: ' + user.name);
console.log('Given Name: ' + user.given_name);
console.log('Family Name: ' + user.family_name);
console.log('Email: ' + user.email);
console.log('Email Verified: ' + user.email_verified);
console.log('Picture: ' + user.picture);
accessTokenClaims['${namespace}/name'] = user.name;
accessTokenClaims['${namespace}/given_name'] = user.given_name;
accessTokenClaims['${namespace}/family_name'] = user.family_name;
accessTokenClaims['${namespace}/email'] = user.email;
accessTokenClaims['${namespace}/email_verified'] = user.email_verified;
accessTokenClaims['${namespace}/picture'] = user.picture;
context.accessToken = accessTokenClaims;
callback(null, user, context);
}
When I debug using the Webtask logs I have values for these claims but when I get my access token these claims do not exist. What am I doing wrong?