Repository navigation
User OTP implementation via RESTAPI endpoints #12350
|
I fully understand the UI based integration of OTP for a user. but my concern is that i do not want to use the OTP UI provided by keycloak. I want the user to be able to integrate OTP in there account just through my application without having the hassle to switch to the keycloak UI. for this is there any api endpoint that returns us the QR generated while adding the OTP device as in the keycloak UI. as shown in the image above i want to be able to retrieve the QR data or the code that is displayed after we click on the Unable to scan? button. any help would be greatly appreciated. |
Replies: 4 comments
|
@pranil420 AFAIK there is no such API but it pretty straightforward to implement it on your own.
|
|
@pranil420 did you figure out how to get the QR code from API? I'm not a java developer so really appreciate if there's any example or sample code for this functionality |
|
I suggest also to Keycloak mantainer to use existing APIs to do this. Using reset-password API ( I verified that secret ( Then, why not enable this API to set information necessary to build an OTP URL (that can be rendered as QR)? Many thanks in advance for any suggestion, or explication of correct rationales |
|
Even this call to set otp over the reset-password endpoint. I get as response 204 But when i look into the admin ui under User credentials there is only password no otp |
@pranil420 AFAIK there is no such API but it pretty straightforward to implement it on your own.
Useful links:
org.keycloak.forms.account.freemarker.model.TotpBean.TotpBean(KeycloakSession, RealmModel, UserModel, UriBuilder)org.keycloak.services.resources.account.AccountFormService.processTotpUpdate()