I’m trying to assess email verification as part of a SAML login flow with Universal Login, and show a “please verify your email” if the account email address isn’t verified. I’m integrating with an app that I have no control over – third party tool – and I am struggling to keep the error within the login experience, prior to the session being created.
I have the basic verify email template action, which seems like it MUST be done at the post-login trigger state (hopefully I’m wrong here?)
exports.onExecutePostLogin = async (event, api) => {
if (!event.user.email_verified) {
api.access.deny('Please verify your email before logging in.');
}
};
But this throws a SAML configuration error that’s not user suitable.
If I take a relayState approach, this still issues the login token, and I can only specify a path within the root app URL, which isn’t fit for purpose…
exports.onExecutePostLogin = async (event, api) => {
if (!event.user.email_verified) {
api.samlResponse.setRelayState('path')
}
};
And if I try and revoke the session with an error, it doesn’t seem to change the login at all, or throw any errors. It just lets the user through
exports.onExecutePostLogin = async (event, api) => {
if (!event.user.email_verified) {
api.session.revoke('please verify your email.')
}
};
I’m not an engineer, so working with limited knowledge of SAML flows, and reaching a limit of ideas for how I can do it. Would love any tips.