App_metadata not included in IdToken or accessToken

Hi there @hmarzouk welcome to the community!

According to the Action code you’ve shared, the app_metadata is set to be added to the user ID Token - However, the Resource Owner Password flow will only return an Access Token. Are you able to confirm whether or not the app_metadata is returned in the Access Token if you update your Action to the following?

exports.onExecutePostLogin = async (event, api) => {
  const namespace = 'https://data-grapes.com';
  api.accessToken.setCustomClaim(`${namespace}/app_metadata`, event.user.app_metadata);
};

Let us know!

2 Likes