App_metadata not being returned in token from /oauth/token even though rule exists

Hi @richard.sanigar,

Try updating your rule to add the metadata to the Access Token instead of the ID Token.

function (user, context, callback) {
  const namespace = ‘https://gotham-city.com/’;
  context.accessToken[namespace + ‘authorities’] = user.app_metadata.roles;
  context.accessToken[namespace + ‘locale’] = user.app_metadata.itc_locale.toUpperCase();
  context.accessToken[namespace + ‘user_name’] = user.user_name;
  callback(null, user, context);
}

Unlike the Authorization Code flow, the Resource Owner Password flow only passes an Access Token and not an ID Token.

1 Like