I encountered an issue when set multiple custom claims to ID token in the same action.
Here is my code:
exports.onExecutePostLogin = async (event, api) => {
if (event.request && event.request.query && event.request.query.redirect_uri) {
api.idToken.setCustomClaim('https://namespace-1.com/app_metadata', event.user.app_metadata);
api.idToken.setCustomClaim('https://namespace-2.com/app_metadata', event.user.app_metadata);
}
}
};
It works as expected for some users. The ID token contains two custom claims as defined above. However, some accounts will encounter infinite loop during the login process. It seems like they can’t be authenticated for some reasons.
Could anyone help me figure out why some accounts face login problem?