We are currently using Actions to check certain conditions and block a user from signing in.
For example exports.onExecutePostLogin = async (event, api) => {
if (conditionIsTrue) {
return api.access.deny('error_code', `Error message we want to show.`);
}
However, this is redirecting back to our application with the error and error message in the GET parameters, but now pausing the login flow and showing an error, similar to the invalid password error.
Is there a way of adding an error on the login page instead of doing a redirect?
Unfortunately, when using the api.access.deny() method in a Post-Login Action, it will send your user back to your callback URL with the error you defined in the script.
There won’t be a way to add the error directly on the login page conditionally based on some criteria.
If needed, you could refer to our Customize Error Pages documentation on how to display a custom error page.