Get verify email token


Is it possible to obtain the token or uri of verify email, to generate a company specific email for new users? We have some companies that would like to use their own logo and text for the email, and some that just would like to use our email theme.

If this is possible, we could obtain the token/uri and create the email based on their “template” and insert the verify email link.


You can override the email-verification.ftl template in a custom email theme.

If that is not sufficient, it is possible to create the token/uri yourself in a custom extension. Look at the code to see how it is done:

Where do I place the custom extension? I already have a running environment, is it possible to add it? And can I just return the URIBuilder?


Custom extensions are usually packaged as a jar or ear file and placed in the standalone/deployments to be loaded at runtime.

Regarding your “can I just return the URIBuilder”, no. But if you can share the code of what you are trying to do here, we can probably help.

I dont have any code written yet, but the plan is, that companies can parse a HTML template to my API on how the email should look. Then my API would call a keycloak endpoint and get a verification link for that user back, so that I can use it in the template the company sent me. And then send the email from my API.

My plan is to parse the necessary things to keyclock endpoint for generating the link: userId, clientId and realm, and then return the link for to verify email.

If this even makes sence?

That sounds good. Once you have some code, let us know if we can be helpful with debugging.

If you have time, would you be able to give me some feedback on my code?
This works like I would like it to, but I cannot figure out how to make the call authorized with an admin account.

Is there a way that I can change the path to be /auth/admin/realms insted of /auth/realms?

Thanks for the help so far.

There are not great resources for doing this. Take a look at how it’s done in this example app:


I’ll take a look at the code later today.

Perfect, that helped me some way, now there is token validation on some things.

Thanks, I did some cleanup and moved some files around. Not a big Java guy, so appreciate your help.

I’m late to this discussion. But still… if your customers are all just in there own realm, you can very quickly just customize a theme for each of them. No Java programming, just theming (and this can include all email message text customizations). Stick with the default behavior as much as possible :slight_smile: . The theme is just packed as a jar and placed as an extension, done. Another item… hook up the build pipeline with and have the customer maintain the text modules themselves…