# Getting verify-email action token

**URL:** <https://forum.keycloak.org/t/getting-verify-email-action-token/3615>\
**Category:** Getting advice\
**Created:** [July 3, 2020, 10:46am UTC](https://forum.keycloak.org/t/getting-verify-email-action-token/3615 "2020-07-03T10:46:55Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![MaximPilipeiko](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/maximpilipeiko/32/8591_2.png) [@MaximPilipeiko](https://forum.keycloak.org/u/MaximPilipeiko)\
**Post date:** [July 3, 2020, 10:46am UTC](https://forum.keycloak.org/t/getting-verify-email-action-token/3615/1 "2020-07-03T10:46:55Z")

</div>

Is it possible to get verify-email action token using Keycloak API?  
Use case: I want to send custom verify email, that cannot be configured by keycloak.  
Now keycloak send verify email with link like this `/login-actions/action-token?key=${token}`. I interested in getting `${token}`.

---

<div class="post-metadata">

**Author:** ![jerosa](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/jerosa/32/2709_2.png) [@jerosa](https://forum.keycloak.org/u/jerosa)\
**Post date:** [March 26, 2021, 12:30pm UTC](https://forum.keycloak.org/t/getting-verify-email-action-token/3615/2 "2021-03-26T12:30:23Z")

</div>

I’m also interested in being able to obtain the action\_token instead of sending an email.  
This would allow us to send the token using other ways like a SMS

---

<div class="post-metadata">

**Author:** ![ddewaele](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/ddewaele/32/2737_2.png) [@ddewaele](https://forum.keycloak.org/u/ddewaele)\
**Post date:** [April 1, 2021, 8:29am UTC](https://forum.keycloak.org/t/getting-verify-email-action-token/3615/3 "2021-04-01T08:29:27Z")

</div>

Did you happen to find a solution for this ? Would like to implement the same thing.

---

<div class="post-metadata">

**Author:** ![jerosa](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/jerosa/32/2709_2.png) [@jerosa](https://forum.keycloak.org/u/jerosa)\
**Post date:** [April 6, 2021, 7:13am UTC](https://forum.keycloak.org/t/getting-verify-email-action-token/3615/4 "2021-04-06T07:13:19Z")

</div>

Unfortunately no. It’s possible to add a custom email template but I haven’t seen any way to obtain the token itself without sending the email to the user.

---

<div class="post-metadata">

**Author:** ![ddewaele](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/ddewaele/32/2737_2.png) [@ddewaele](https://forum.keycloak.org/u/ddewaele)\
**Post date:** [May 16, 2021, 9:19am UTC](https://forum.keycloak.org/t/getting-verify-email-action-token/3615/5 "2021-05-16T09:19:49Z")

</div>

So there is no way to programmatically invite someone to signup using the API ?

---

<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:** [May 17, 2021, 10:54am UTC](https://forum.keycloak.org/t/getting-verify-email-action-token/3615/6 "2021-05-17T10:54:37Z")

</div>

AFAIK, there is no way to get an action token via the Admin API.

I have solved this two ways before:

1. adding a REST endpoint that takes the `user_id`, `client_id` and `redirect_uri` and returns the constructed link with the serialized action token
2. adding a REST endpoint that takes the `user_id`, `client_id` and `redirect_uri`, constructs the link, and sends it using a custom email template or an API call to an SMS provider.

---

<div class="post-metadata">

**Author:** ![ddewaele](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/ddewaele/32/2737_2.png) [@ddewaele](https://forum.keycloak.org/u/ddewaele)\
**Post date:** [May 31, 2021, 6:53am UTC](https://forum.keycloak.org/t/getting-verify-email-action-token/3615/7 "2021-05-31T06:53:15Z")

</div>

Regarding option 1, does that mean there is a way to construct that action token based on user\_id, client\_id and redirect\_uri ? What API call is required for that ?

---

<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:** [May 31, 2021, 7:47am UTC](https://forum.keycloak.org/t/getting-verify-email-action-token/3615/8 "2021-05-31T07:47:04Z")

</div>

@ddewaele Not using the Admin API, but you can do it in code if you are writing an extension. Look at this example of creating an `ExecuteActionsActionToken` and then building the link using a `UriBuilder`:

> <https://github.com/keycloak/keycloak/blob/master/services/src/main/java/org/keycloak/services/resources/admin/UserResource.java#L803>

---

<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, 9:39am UTC](https://forum.keycloak.org/t/getting-verify-email-action-token/3615/9 "2021-11-12T09:39:17Z")

</div>

Hello @xgp,  
Do you have an example on how to do this, or where to place the extension?

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:38am UTC](https://forum.keycloak.org/t/getting-verify-email-action-token/3615/10 "2021-11-12T11:38:13Z")

</div>

There is decent documentation on writing extensions. For example, writing your own REST endpoint extensions: [Server Developer Guide](https://www.keycloak.org/docs/latest/server_development/#_extensions_rest)  
And here’s some example code: [keycloak/examples/providers/rest at main · keycloak/keycloak · GitHub](https://github.com/keycloak/keycloak/tree/main/examples/providers/rest)
