Compatibility with Keycloak 18.x.x #16
-
Hi there. I'm trying to use this authenticator with my custom theme on Keycloak 18.0.0. I was able to configure the authentication flow adding and showing email OTP form based on user attribute condition, but I'm getting the following error when I try to send the code: ERROR [com.mesutpiskin.keycloak.auth.email.EmailAuthenticatorForm] (executor-thread-5) Failed to send the access code email. realm=dev user=02768514707: org.keycloak.email.EmailException: Failed to template email I created (and customized) the email-code-form.ftl inside the login folder of my custom theme, and it works perfectly. I also created code-email.ftl files inside email/html and email/text and modified email/theme.properties with the proper content. Could it be related to the version of Keycloak? Appreciate any help. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
The error message suggests that the template file "text/code-email.ftl" could not be found. Here are a few things you can check to resolve this issue: Template Location: Make sure the template file "code-email.ftl" is placed in the correct location within your custom theme. It should be located in the "email/text" directory of your theme. Template Names: Double-check that the names of your template files match exactly as specified in your code. Ensure there are no typos or differences in letter case. Theme Configuration: Verify that you have correctly modified the "email/theme.properties" file in your custom theme. Ensure that the property code-email=code-email.ftl is set to map the template file. Keycloak Version: It's possible that the issue is related to the Keycloak version you are using. However, based on the code you provided, it should work with Keycloak 18.0.0. If you have recently upgraded Keycloak, make sure that your custom theme is compatible with the new version. If you have confirmed that the template file is in the correct location and properly configured, and you are still experiencing the issue, it may be helpful to check the Keycloak server logs for any additional error messages or stack traces that could provide more insight into the problem. |
Beta Was this translation helpful? Give feedback.
-
My sorry. I was forgeting the email/theme.properties configuration. I managed to get it working on Keycloak 18.0.0 with v0.4-KC20.0.1 release. Also tested v0.4-KC21.1.0 wich gives me the following error: [org.keycloak.services.error.KeycloakErrorHandler] (executor-thread-12) Uncaught server error: java.lang.NoSuchMethodError: org.keycloak.authentication.AuthenticationFlowContext.getHttpRequest()Lorg/keycloak/http/HttpRequest; at com.mesutpiskin.keycloak.auth.email.EmailAuthenticatorForm.action(EmailAuthenticatorForm.java:70) However, my problem is solved, thanks for your help. |
Beta Was this translation helpful? Give feedback.
The error message suggests that the template file "text/code-email.ftl" could not be found. Here are a few things you can check to resolve this issue:
Template Location: Make sure the template file "code-email.ftl" is placed in the correct location within your custom theme. It should be located in the "email/text" directory of your theme.
Template Names: Double-check that the names of your template files match exactly as specified in your code. Ensure there are no typos or differences in letter case.
Theme Configuration: Verify that you have correctly modified the "email/theme.properties" file in your custom theme. Ensure that the property code-email=code-email.ftl is set to map the templ…