'How to reset a Keycloak authentication flow and display a message or error message?

Within a custom authentication flow SPI, you can reset the entire flow simply returning

context.resetFlow();

in e.g. an action method.

However, can you attach a message or attribute when resetting the flow, basically passing it into the Freemarker UI upon reset?



Solution 1:[1]

context.forkWithErrorMessage(new FormMessage('label', 'Your error message here'));

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Metafr