# Get verify email token

**URL:** <https://forum.keycloak.org/t/get-verify-email-token/12045>\
**Category:** Getting advice\
**Created:** [November 12, 2021, 8:38am UTC](https://forum.keycloak.org/t/get-verify-email-token/12045 "2021-11-12T08:38:42Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![nzd](https://avatars.discourse-cdn.com/v4/letter/n/e36b37/32.png) [@nzd](https://forum.keycloak.org/u/nzd)\
**Post date:** [November 12, 2021, 8:38am UTC](https://forum.keycloak.org/t/get-verify-email-token/12045/1 "2021-11-12T08:38:42Z")

</div>

Hello,

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.

Regards,  
Nikolas

---

<div class="post-metadata">

**Author:** ![xgp](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/xgp/32/2589_2.png) [@xgp](https://forum.keycloak.org/u/xgp)\
**Post date:** [November 12, 2021, 11:34am UTC](https://forum.keycloak.org/t/get-verify-email-token/12045/2 "2021-11-12T11:34:27Z")

</div>

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

> <https://github.com/keycloak/keycloak/blob/main/themes/src/main/resources/theme/base/email/text/email-verification.ftl>

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:

> <https://github.com/keycloak/keycloak/blob/main/services/src/main/java/org/keycloak/authentication/requiredactions/VerifyEmail.java#L140>

---

<div class="post-metadata">

**Author:** ![nzd](https://avatars.discourse-cdn.com/v4/letter/n/e36b37/32.png) [@nzd](https://forum.keycloak.org/u/nzd)\
**Post date:** [November 12, 2021, 11:52am UTC](https://forum.keycloak.org/t/get-verify-email-token/12045/3 "2021-11-12T11:52:45Z")

</div>

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?

Thanks!

---

<div class="post-metadata">

**Author:** ![xgp](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/xgp/32/2589_2.png) [@xgp](https://forum.keycloak.org/u/xgp)\
**Post date:** [November 12, 2021, 12:01pm UTC](https://forum.keycloak.org/t/get-verify-email-token/12045/4 "2021-11-12T12:01:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![nzd](https://avatars.discourse-cdn.com/v4/letter/n/e36b37/32.png) [@nzd](https://forum.keycloak.org/u/nzd)\
**Post date:** [November 12, 2021, 12:25pm UTC](https://forum.keycloak.org/t/get-verify-email-token/12045/5 "2021-11-12T12:25:07Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![xgp](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/xgp/32/2589_2.png) [@xgp](https://forum.keycloak.org/u/xgp)\
**Post date:** [November 12, 2021, 12:32pm UTC](https://forum.keycloak.org/t/get-verify-email-token/12045/6 "2021-11-12T12:32:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nzd](https://avatars.discourse-cdn.com/v4/letter/n/e36b37/32.png) [@nzd](https://forum.keycloak.org/u/nzd)\
**Post date:** [November 15, 2021, 2:34pm UTC](https://forum.keycloak.org/t/get-verify-email-token/12045/7 "2021-11-15T14:34:21Z")

</div>

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?

> **[GitHub - nzdvis/keycloak-custom-rest-api](https://github.com/nzdvis/keycloak-custom-rest-api)**
>
> Contribute to nzdvis/keycloak-custom-rest-api development by creating an account on GitHub.

Thanks for the help so far.

---

<div class="post-metadata">

**Author:** ![xgp](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/xgp/32/2589_2.png) [@xgp](https://forum.keycloak.org/u/xgp)\
**Post date:** [November 15, 2021, 2:43pm UTC](https://forum.keycloak.org/t/get-verify-email-token/12045/8 "2021-11-15T14:43:25Z")

</div>

> [@nzd](#):
>
> but I cannot figure out how to make the call authorized with an admin account.

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

> <https://github.com/dteleguin/beercloak/blob/master/beercloak-module/src/main/java/beercloak/resources/AbstractAdminResource.java>

> [@nzd](#):
>
> Is there a way that I can change the path to be /auth/admin/realms insted of /auth/realms?
> 
> [GitHub - nzdvis/keycloak-custom-rest-api](https://github.com/nzdvis/keycloak-custom-rest-api)

No.

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

---

<div class="post-metadata">

**Author:** ![nzd](https://avatars.discourse-cdn.com/v4/letter/n/e36b37/32.png) [@nzd](https://forum.keycloak.org/u/nzd)\
**Post date:** [November 16, 2021, 7:52am UTC](https://forum.keycloak.org/t/get-verify-email-token/12045/9 "2021-11-16T07:52:53Z")

</div>

> [@xgp](#):
>
> There are not great resources for doing this. Take a look at how it’s done in this example app:
> 
> [https://github.com/dteleguin/beercloak/blob/master/beercloak-module/src/main/java/beercloak/resources/AbstractAdminResource.java](https://github.com/dteleguin/beercloak/blob/master/beercloak-module/src/main/java/beercloak/resources/AbstractAdminResource.java)

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

> [@xgp](#):
>
> I’ll take a look at the code later today.

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

---

<div class="post-metadata">

**Author:** ![vju42](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/vju42/32/1143_2.png) [@vju42](https://forum.keycloak.org/u/vju42)\
**Post date:** [November 17, 2021, 7:58pm UTC](https://forum.keycloak.org/t/get-verify-email-token/12045/10 "2021-11-17T19:58:50Z")

</div>

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 🙂 . The theme is just packed as a jar and placed as an extension, done. Another item… hook up the build pipeline with [poeditor.com](http://poeditor.com) and have the customer maintain the text modules themselves…
