# Java client error related secret\_token

**URL:** <https://discuss.elastic.co/t/java-client-error-related-secret-token/221705>\
**Category:** APM\
**Tags:** java\
**Created:** [March 2, 2020, 2:45pm UTC](https://discuss.elastic.co/t/java-client-error-related-secret-token/221705 "2020-03-02T14:45:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rschirin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rschirin/32/45283_2.png) [@rschirin](https://discuss.elastic.co/u/rschirin)\
**Post date:** [March 2, 2020, 2:45pm UTC](https://discuss.elastic.co/t/java-client-error-related-secret-token/221705/1 "2020-03-02T14:45:34Z")

</div>

Hi,  
I'm facing an error when I try to use APM Java agent and secret\_token.  
In the following scenario:

client's side:

`-Delastic.apm.secret_token=thisisarandomstring`

server's side:

`secret_token: thisisarandomstring`

everything works properly.  
If I decide to create a keystore with

`apm-server keystore add secret_token`

and then in my apm-server.yml

`secret_token: ${secret_token}`

on my client side I'm not understanding what I have to specify. where can I find the encrypted value?  
can you help me?

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [March 2, 2020, 3:16pm UTC](https://discuss.elastic.co/t/java-client-error-related-secret-token/221705/2 "2020-03-02T15:16:00Z")

</div>

Hi @rschirin,

The value that you should provide on the agent side is the same un-encrypted value that you provided when creating the `secret_token` value on the server.

What this secret token provides is a way to make sure that no other agents that the ones you have set with this secret token can send APM data to your server.

While this value is stored in plain-text on the client, only the agents that are under your control would have it and will be able to send data.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 23, 2020, 11:16am UTC](https://discuss.elastic.co/t/java-client-error-related-secret-token/221705/3 "2020-03-23T11:16:06Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
