I am using the Universal Login with Classic Experience in a SPA. I am trying to deny access to users whose password has not been changed in 90 days. For example:
exports.onExecutePostLogin = async (event, api) => {
if (isPasswordExpired(event)) {
// This works, but this isn't going to show the user
// that their access is denied
// api.redirect.sendUserTo(`https://login.staging.videoamp.com/v2/logout?returnTo=https://stage-fc-ui.videoamp.com/&client_id=${event.client.client_id}`);
// This results in an infinite loop
api.access.deny("Unauthorized");
}
};
You should be able add an error message to sendUserTo as a query param in the URL at which point you can display to users any way you please. Something like:
Hey @wmangerva no problem, happy to help where I can!
It might be easier to just redirect to your custom error page without any forwarded error message - That is, rely on the Action code logic to redirect to the relevant error page and display the error there.