Twitter nickname is not the same as screen_name

Hi @edent.
I’m guessing this was either an oversight or that the profile’s screen_name wasn’t available when this connection type was implemented in Auth0. I will report this internally so hopefully this will eventually get fixed.

In the meantime, a good workaround is to create the following rule:

function (user, context, callback) {
  // Put the user's screen_name as the nickname
  // for Twitter connections
  if (context.connection === 'twitter' && user.screen_name) {
    user.nickname = user.screen_name;
  }
  callback(null, user, context);
}

This will modify the information that applications get (either from the ID Token or from the /userinfo endpoint), but will not modify the actual user profile stored. Keep that in mind that if you use /api/v2/users or the dashboard to get the full user profile will still see the full name in the nickname property.

2 Likes