Hey @edent
I took a closer look at the older post you made, are you looking to just temporarily override the nickname
field for the ID Token on the frontend or the Access Token for the /userinfo
endpoint?
I haven’t tested this, but try setting the nickname via the built-in api setCustomClaim
functions.
exports.onExecutePostLogin = async (event, api) => {
// Put the user screen_name as the nickname
// for Twitter connections
if (event.connection.name === 'twitter' && event.user.screen_name) {
api.idToken.setCustomClaim('nickname', event.user.screen_name);
api.accessToken.setCustomClaim('nickname', event.user.screen_name);
}
};
Generally you would create a custom claim in the tokens with a namespace you own, but give this a try and see if this will resolve your issue.