FX-HAO / keycloak-phone-authenticator

Obtain token and reset password via SMS
130 stars 43 forks source link

How do I set up Direct grant flow? #12

Closed gisly closed 2 years ago

gisly commented 2 years ago

I don't understand this part of the instruction:

Configuration
Configure your REALM to use the phone number and verification code Authentication. First create a new REALM (or select a previously created REALM).

Under Authentication > Flows:

Copy the 'Direct Grant' flow to 'Direct grant with phone' flow
Click on 'Actions > Add execution' on the 'Provide Phone Number' line
Click on 'Actions > Add execution' on the 'Provide Verification Code' line
Set both of 'Provide Phone Number' and 'Provide Verification Code' to 'REQUIRED'

There are no Provide Phone Number' line or 'Provide Verification Code' line, so how should I set up the direct grant flow?

FX-HAO commented 2 years ago

Please make sure you set up this library correctly. you can confirm it on 'Server Info' -> 'Provider'. image

If you don't know how to integrate this library into Keycloak, please refer to https://github.com/FX-HAO/keycloak-phone-authenticator/tree/master/examples

gisly commented 2 years ago

Thank you! I changed the display name of the providers and could not find them.

gisly commented 2 years ago

Could you please help again with this issue? I can now send the SMS code and get the list of codes. However, I cannot get the token using a request to /auth/realms/{realm}/protocol/openid-connect/token, getting the "Invalid user credentials" error. I've added logging, and it seems that VerificationCodeAuthenticator.authenticate is not called at all, although I've set the new "Direct grant with SMS" flow for the client id I am using. Should I do something else to make keycloak call the VerificationCodeAuthenticator?

gisly commented 2 years ago

Sorry, I managed to do it. I actually changed searchForUserByUserAttribute to the more recent searchForUserByUserAttributeStream and it started working suddenly