Verify email using REST API to create user?

2,170 views
Skip to first unread message

Moritz Schmitz von Huelst

unread,
Apr 29, 2021, 12:54:41 PM4/29/21
to Keycloak User

When setting 'Verify email' to 'true' in the realm settings and registering a user through Keycloak an email is sent to the user. The template used is 'email-verification.ftl'.

When having the same realm setting but creating a user through the REST API 'POST /{realm}/users' the email is not sent. There is a REST API method 'PUT /{realm}/users/{id}/send-verify-email' available, but it uses a different email template 'executeActions.ftl'.

My expectation is Keycloak to send out an email 'normally' when the realm setting requires to verify your email. No matter whether you use the REST API or the UI.

Is there any fix/workaround to this?

Garth

unread,
Apr 30, 2021, 2:53:02 AM4/30/21
to keyclo...@googlegroups.com
Unfortunately, that's how it is in the code. We encountered the same problem, and had to create a custom REST endpoint to use the `email-verification.ftl` template.

On Thu, Apr 29, 2021, at 6:54 PM, Moritz Schmitz von Huelst wrote:
> When setting 'Verify email' to 'true' in the realm settings and
> registering a user through Keycloak an email is sent to the user. The
> template used is 'email-verification.ftl'.
>
> When having the same realm setting but creating a user through the REST
> API 'POST /{realm}/users' the email is *not* sent. There is a REST API
> method 'PUT /{realm}/users/{id}/send-verify-email' available, but it
> uses a different email template 'executeActions.ftl'.
>
> My expectation is Keycloak to send out an email 'normally' when the
> realm setting requires to verify your email. No matter whether you use
> the REST API or the UI.
>
> Is there any fix/workaround to this?
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Keycloak User" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to keycloak-use...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/keycloak-user/14d674c8-6c0e-42c3-ad4f-70a2b8cbb7b3n%40googlegroups.com <https://groups.google.com/d/msgid/keycloak-user/14d674c8-6c0e-42c3-ad4f-70a2b8cbb7b3n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Moritz Schmitz von Huelst

unread,
Apr 30, 2021, 4:50:42 AM4/30/21
to Keycloak User
Thanks for the response. This looks like a bug, or at least undocumented/unexpected behavior. I opened a ticket at Keycloak: https://issues.redhat.com/browse/KEYCLOAK-17925
Reply all
Reply to author
Forward
0 new messages