Required action to verify email by code
This Keycloak plugin adds a required action to verify email by code.
- Send code on your email
- Verify email by code
The version 11.x of this plugin is compatible with Keycloak 11.0.3
and higher.
The plugin installation is simple and can be done without a Keycloak server restart.
- Download the latest release from the releases page
- Copy the JAR file into the
standalone/deployments
directory in your Keycloak server's root - Restart Keycloak (optional, hot deployment should work)
You can also clone the Github Repository and install the plugin locally with the following command:
$ mvn clean install wildfly:deploy
Verify required action is deploy in keycloak. Got to {keycloak url}/auth/admin/master/console/#/server-info/providers.
Once the installation is complete, the Verify Email by code
required action appears in "
authentication/required-actions" on your realm. Register and enable "VERIFY_EMAIL_CODE" and disable "VERIFY_EMAIL"
Once enabled, you can add the following action on user edit page:
You can override individual templates in your own theme. To create a custom email message for the mytheme theme copy themes/base/email/email-verification-with-code.ftl (in keycloak theme) to themes/mytheme/email/
To create a custom email verify form for the mytheme theme copy template login-verify-email-code.ftl to themes/mytheme/login
Verify email code is generated using org.keycloak.common.util.RandomString
. By default generated code will be 8 characters long and will use alphanumeric symbols. You may customize this behavior using SPI configuration in your standalone.xml
file:
- property
codeLength
is a numeric value representing the number of symbols, defaults to8
- property
codeSymbols
is a string value listing all accepted symbols, defaults toRandomString.alphanum
e.g. configure action to generate a code of 6 digits :
<subsystem xmlns="urn:jboss:domain:keycloak-server:1.1">
[...]
<spi name="required-action">
<provider name="VERIFY_EMAIL_CODE" enabled="true">
<properties>
<property name="codeLength" value="6"/>
<property name="codeSymbols" value="0123456789"/>
</properties>
</provider>
</spi>
</subsystem>