KEYCLOAK - 2FA with SMS based OTP text messages | Niko Köbler (@dasniko)
Why Stack Overflow recommends it
Stack Overflow users link it when answering how to add SMS or email based 2FA and phone verification to Keycloak, since it is a working example built on the Authentication SPI.
Recommended by 3 people across 3 different months, 2021 to 2023.
What it is
A 19-minute tutorial by Keycloak consultant Niko Köbler on building a custom two-factor authentication flow for Keycloak that sends one-time passwords by SMS. It uses the Keycloak Authentication SPI, with code on GitHub and a companion blog post, and is explicitly a demo to be hardened before production use.
What people said
Recommends BrianK · 2021-03 · Stack Overflow · on “Keycloak with user verification using SMS”
The best example I found was this one. He has a blog post and a 20 minute video to explain it. It was done December of 2020 and it built and ran right out of the box. [LINK] code for the above blog post: [LINK] there's even a video [this video]
Recommends motobói · 2022-06 · Stack Overflow · on “How to enable 2FA using email using keycloak-admin-client in spring boot”
I agree that is necessary to write a custom provider for this use case. Take a look at [LINK] and [this video] for a look at how to implement that. That is an example via SMS, but via e-mail would be very similar, changing just the way of sending the code to the user.
Recommends Guilherme · 2023-04 · Stack Overflow · on “Keycloak phone number verification using Twilio”
Dasniko [LINK] has a good implementation of 2FA with SMS, made using Keycloak's Service Provider Interfaces (SPI) As I see, you would just need to re-write the AwsSmsService into a service using Twilio [LINK] And he also have a youtube video explaining the usage [this video]