javaauthenticationkeycloaktwo-factor-authentication

Keycloak authentication two-step authentication flow order


I'm trying to implement Two-Factor authentication (SMS/OTP), where SMS is required to have priority over OTP, so it must be shown first, OTP is just another way to authenticate via "Try Another Way". I have a flow order with SMS priority but still, OTP shows first.

enter image description here


Solution

  • This is a known issue in Keycloak. As of now, the order of authentications is dependent on the order of the credentials as they are saved in the user, rather than the order of the authentication flow. There's a GitHub Issue and a Pull Request about this. So as of now, there sadly isn't much to be done about it except waiting until it is merged and part of a new release.