# "Authentication using apikey failed - invalid ApiKey value"

**URL:** <https://discuss.elastic.co/t/authentication-using-apikey-failed-invalid-apikey-value/266083>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security\
**Created:** [March 3, 2021, 10:14am UTC](https://discuss.elastic.co/t/authentication-using-apikey-failed-invalid-apikey-value/266083 "2021-03-03T10:14:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![freddux](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/freddux/32/84874_2.png) [@freddux](https://discuss.elastic.co/u/freddux)\
**Post date:** [March 3, 2021, 10:14am UTC](https://discuss.elastic.co/t/authentication-using-apikey-failed-invalid-apikey-value/266083/1 "2021-03-03T10:14:51Z")

</div>

Hi guys!

New user here, I'm currently finding a tonne of this in my `elasticsearch_server.json` log, and I can't find out where it is:

```auto
{"type": "server", "timestamp": "2021-03-03T11:10:08,518+01:00", "level": "WARN", "component": "o.e.x.s.a.AuthenticationService", "cluster.name": "elasticsearch", "node.name": "node-1", "message": "Authentication using apikey failed - invalid ApiKey value", "cluster.uuid": "UbN_iEEITBuzgDzs
-em7Ww", "node.id": "U-ZizcsnT4yBtKHF3xomwQ" ,
"stacktrace": ["java.lang.IllegalArgumentException: invalid ApiKey value",
"at org.elasticsearch.xpack.security.authc.ApiKeyService.getCredentialsFromHeader(ApiKeyService.java:701) ~[x-pack-security-7.10.0.jar:7.10.0]",
"at org.elasticsearch.xpack.security.authc.ApiKeyService.authenticateWithApiKeyIfPresent(ApiKeyService.java:355) [x-pack-security-7.10.0.jar:7.10.0]",
"at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.checkForApiKey(AuthenticationService.java:347) [x-pack-security-7.10.0.jar:7.10.0]",
"at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lambda$authenticateAsync$0(AuthenticationService.java:329) [x-pack-security-7.10.0.jar:7.10.0]",
"at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:63) [elasticsearch-7.10.0.jar:7.10.0]",
"at org.elasticsearch.xpack.security.authc.TokenService.getAndValidateToken(TokenService.java:405) [x-pack-security-7.10.0.jar:7.10.0]",
"at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lambda$authenticateAsync$2(AuthenticationService.java:325) [x-pack-security-7.10.0.jar:7.10.0]",
"at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lambda$lookForExistingAuthentication$6(AuthenticationService.java:384) [x-pack-security-7.10.0.jar:7.10.0]",
"at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lookForExistingAuthentication(AuthenticationService.java:395) [x-pack-security-7.10.0.jar:7.10.0]",
"at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.authenticateAsync(AuthenticationService.java:320) [x-pack-security-7.10.0.jar:7.10.0]",
"at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.access$000(AuthenticationService.java:261) [x-pack-security-7.10.0.jar:7.10.0]",
"at org.elasticsearch.xpack.security.authc.AuthenticationService.authenticate(AuthenticationService.java:141) [x-pack-security-7.10.0.jar:7.10.0]",
"at org.elasticsearch.xpack.security.authc.AuthenticationService.authenticate(AuthenticationService.java:126) [x-pack-security-7.10.0.jar:7.10.0]",
"at org.elasticsearch.xpack.security.rest.SecurityRestFilter.handleRequest(SecurityRestFilter.java:70) [x-pack-security-7.10.0.jar:7.10.0]",
"at org.elasticsearch.rest.RestController.dispatchRequest(RestController.java:258) [elasticsearch-7.10.0.jar:7.10.0]",
"at org.elasticsearch.rest.RestController.tryAllHandlers(RestController.java:340) [elasticsearch-7.10.0.jar:7.10.0]",
"at org.elasticsearch.rest.RestController.dispatchRequest(RestController.java:191) [elasticsearch-7.10.0.jar:7.10.0]",

```

I'm trying to figure out which host this comes from, is it really the elastichost itself? And why? I have xpack enabled, and we are running kibana/filebeat and it seems to work, so I'm not sure which host could be the culprit, so I want to know how to find it out.

Here is the elastic config:

```auto
> node.name: node-1
> path.data: /var/lib/elasticsearch
> path.logs: /var/log/elasticsearch
> cluster.initial_master_nodes: node-1
> network.host: 0.0.0.0
> xpack.security.enabled: true
> xpack.security.authc.api_key.enabled: true
> xpack.security.http.ssl.enabled: true
> xpack.security.transport.ssl.enabled: true
> xpack.security.http.ssl.key: /etc/elasticsearch/certs/foo.key
> xpack.security.http.ssl.certificate: /etc/elasticsearch/certs/foo.crt
> xpack.security.transport.ssl.key: /etc/elasticsearch/certs/foo.key
> xpack.security.transport.ssl.certificate: /etc/elasticsearch/certs/foo.crt

```

---

<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 31, 2021, 10:15am UTC](https://discuss.elastic.co/t/authentication-using-apikey-failed-invalid-apikey-value/266083/2 "2021-03-31T10:15:39Z")

</div>

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