It is an alternative authentication method, sending the user a different login code to their email for each login. Usable instead of traditional passwords or as additional identity confirmation (two-step authentication).
It grants improved security, by removing the security issues of relying on user created passwords.
Developed and tested in Keycloak version 12.0.1. Tested for 13.0.1.
For the LoginFlowTest testing the Maildev container must be running. It can be started with the restart.sh script.
Once keycloak-otp-login is deployed on your server, (re-)start said server.
You can use ./restart.sh in the root directory of the project.
Setup:
Now open the web admin console of keycloak, under Configure go to Authentication. In the Flows tab create a copy of the Browser flow.
-
Using instead of passwords
- Delete
Username Password FormandBrowser - Conditional OTPin your new flows Forms.
- Add a new execution to
*your flow name* Formsusing theOtp-loginprovider and set its requirement toREQUIRED.
- Delete
-
Using as second step authentication
- Delete
OTP Formin your new flows Forms.
- Add exec
*your flow name* Browser - Conditional OTPusing theOtp-loginprovider and set its requirement toREQUIRED.
- Delete
Continue with:
-
Switch to the
Bindingstab and change your Browser Flow to your new flow and save the settings. -
Now open the
Realm Settings, go to theThemestab and select theOtp-Loginfor the Login- aswell as the Email Theme. -
Enable
Internationalizationand remove all theSupported Localesexceptdeanden(and any languages you added) and set theDefault Localeto your preference and save.
Inspired by Magic Link authenticator for Keycloak







