Hi @selvi,
This line of code const userAppMetadata = event.user.app_metadata;
is used to get the user’s current app_metadata information.
If you need to include the user_metadata and app_metadata in your access token, you would need to add them as a custom claim.
exports.onExecutePostLogin = async (event, api) => {
const namespace = 'https://myapp.example.com';
if (event.authorization) {
// Set claims in access token
api.accessToken.setCustomClaim(`${namespace}/user_metadata`, event.user.user_metadata);
api.accessToken.setCustomClaim(`${namespace}/app_metadata`, event.user.app_metadata);
}
};
(Reference: Adding custom claims to tokens)
Thanks,
Rueben