# Missing authentication token for REST request

**URL:** https://discuss.elastic.co/t/missing-authentication-token-for-rest-request/39779
**Category:** Elasticsearch
**Tags:** elastic-stack-security
**Created:** [January 21, 2016, 2:12pm UTC](https://discuss.elastic.co/t/missing-authentication-token-for-rest-request/39779 "2016-01-21T14:12:59Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![zhangqz](https://avatars.discourse-cdn.com/v4/letter/z/47e85d/32.png) [@zhangqz](https://discuss.elastic.co/u/zhangqz)
#### Post date: [January 21, 2016, 2:12pm UTC](https://discuss.elastic.co/t/missing-authentication-token-for-rest-request/39779/1 "2016-01-21T14:12:59Z")

</div>

Everything was working fine until installing shield. This is my first time to configure the shield plug. Could you please help to resolve this issue? Thank you very much!

**My environment:**  
OS: CentOS 7  
elasticsearch-2.1.1  
logstash-2.1.1  
kibana-4.3.1

**Testing result**

# curl -u es\_admin -XGET '[http://localhost:9200/](http://localhost:9200/)'

Enter host password for user 'es\_admin':  
{  
"name" : "Dmitri Smerdyakov",  
"cluster\_name" : "elasticsearch",  
"version" : {  
"number" : "2.1.1",  
"build\_hash" : "40e2c53a6b6c2972b3d13846e450e66f4375bd71",  
"build\_timestamp" : "2015-12-15T13:05:55Z",  
"build\_snapshot" : false,  
"lucene\_version" : "5.3.1"  
},  
"tagline" : "You Know, for Search"  
}

# curl -u es\_admin -XPUT 'localhost:9200/people/person/l?pretty' -d '{"name" : "Administrator"}';

Enter host password for user 'es\_admin':  
{  
"\_index" : "people",  
"\_type" : "person",  
"\_id" : "l",  
"\_version" : 1,  
"\_shards" : {  
"total" : 2,  
"successful" : 1,  
"failed" : 0  
},  
"created" : true  
}

**Error message**

[2016-01-21 21:41:08,099][INFO][rest.suppressed] /\_bulk Params: {}  
ElasticsearchSecurityException[**missing authentication token for REST** request [/\_bulk]]  
at org.elasticsearch.shield.support.Exceptions.authenticationError(Exceptions.java:39)  
at org.elasticsearch.shield.authc.DefaultAuthenticationFailureHandler.missingToken(DefaultAuthenticationFailureHandler.java:65)  
at org.elasticsearch.shield.authc.InternalAuthenticationService.authenticate(InternalAuthenticationService.java:96)  
at org.elasticsearch.shield.rest.ShieldRestFilter.process(ShieldRestFilter.java:71)  
at org.elasticsearch.rest.RestController$ControllerFilterChain.continueProcessing(RestController.java:265)  
at org.elasticsearch.rest.RestController.dispatchRequest(RestController.java:176)  
at org.elasticsearch.http.HttpServer.internalDispatchRequest(HttpServer.java:128)  
at org.elasticsearch.http.HttpServer$Dispatcher.dispatchRequest(HttpServer.java:86)  
at org.elasticsearch.http.netty.NettyHttpServerTransport.dispatchRequest(NettyHttpServerTransport.java:348)  
at org.elasticsearch.http.netty.HttpRequestHandler.messageReceived(HttpRequestHandler.java:63)  
at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)  
at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)  
... ....  
... ...

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [January 22, 2016, 6:22am UTC](https://discuss.elastic.co/t/missing-authentication-token-for-rest-request/39779/2 "2016-01-22T06:22:54Z")

</div>

Is the error returning during that put, or somewhere else?

---

<div class="post-metadata">

### Author: ![zhangqz](https://avatars.discourse-cdn.com/v4/letter/z/47e85d/32.png) [@zhangqz](https://discuss.elastic.co/u/zhangqz)
#### Post date: [January 22, 2016, 6:39am UTC](https://discuss.elastic.co/t/missing-authentication-token-for-rest-request/39779/3 "2016-01-22T06:39:46Z")

</div>

Hello Mark,  
Thank you very much for your reply.

Yes. This is a error message of Elasticsearch during data input. My system can not display any new log because of the error.

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [January 22, 2016, 6:41am UTC](https://discuss.elastic.co/t/missing-authentication-token-for-rest-request/39779/4 "2016-01-22T06:41:28Z")

</div>

Did you setup Logstash correctly - [https://www.elastic.co/guide/en/shield/current/logstash.html](https://www.elastic.co/guide/en/shield/current/logstash.html)?

---

<div class="post-metadata">

### Author: ![zhangqz](https://avatars.discourse-cdn.com/v4/letter/z/47e85d/32.png) [@zhangqz](https://discuss.elastic.co/u/zhangqz)
#### Post date: [January 22, 2016, 7:48am UTC](https://discuss.elastic.co/t/missing-authentication-token-for-rest-request/39779/5 "2016-01-22T07:48:02Z")

</div>

Hello Mark,

Thank you very much for your advice!

My steps:

**1. create a logstash user:**

esusers useradd elk -r logstash

esusers list  
elk : logstash  
es\_admin : admin

**2. Modify logstash configuration file:**  
output {  
elasticsearch {  
hosts =\> "10.7.1.86"  
user =\> "elk"  
password =\> "koooooooo"  
}  
stdout { codec=\> rubydebug }  
}

**3. Check the configuration file roles.yml:**

logstash:  
cluster: indices:admin/template/get, indices:admin/template/put  
indices:  
'logstash-\*':  
privileges: indices:data/write/bulk, indices:data/write/delete, indices:data/write/update, indices:data/read/search, indices:data/read/scroll, create\_index

**New error message are:**

**Logstash:**  
Attempted to send a bulk request to Elasticsearch configured at '["[http://10.7.1.86:9200/](http://10.7.1.86:9200/)"]', but an error occurred and it failed! Are you sure you can reach elasticsearch from this machine using the configuration provided? {:client\_config=\>{:hosts=\>["[http://10.7.1.86:9200/](http://10.7.1.86:9200/)"], :ssl=\>nil, :transport\_options=\>{:socket\_timeout=\>0, :request\_timeout=\>0, :proxy=\>nil, :ssl=\>{}}, :transport\_class=\>Elasticsearch::Transport::Transport::HTTP::Manticore, :headers=\>{"Authorization"=\>"Basic ZWxrOmtvYmF0aW1l"},

**Elasticsearch:**  
[2016-01-22 15:37:55,668][INFO][rest.suppressed] /\_bulk Params: {}  
ElasticsearchSecurityException[unable to authenticate user [elk] for REST request [/\_bulk]]  
at org.elasticsearch.shield.support.Exceptions.authenticationError(Exceptions.java:39)  
at org.elasticsearch.shield.authc.DefaultAuthenticationFailureHandler.unsuccessfulAuthentication(DefaultAuthenticationFailureHandler.java:35)  
at org.elasticsearch.shield.authc.InternalAuthenticationService.authenticate(InternalAuthenticationService.java:111)  
at org.elasticsearch.shield.rest.ShieldRestFilter.process(ShieldRestFilter.java:71)  
at org.elasticsearch.rest.RestController$ControllerFilterChain.continueProcessing(RestController.java:265)  
at org.elasticsearch.rest.RestController.dispatchRequest(RestController.java:176)

---

<div class="post-metadata">

### Author: ![zhangqz](https://avatars.discourse-cdn.com/v4/letter/z/47e85d/32.png) [@zhangqz](https://discuss.elastic.co/u/zhangqz)
#### Post date: [February 15, 2016, 2:03am UTC](https://discuss.elastic.co/t/missing-authentication-token-for-rest-request/39779/6 "2016-02-15T02:03:36Z")

</div>

Shield with the same configure file is working fine in new environment:  
CentOS 7  
logstash-2.2.1  
logstash-2.2.1  
kibana-4.4.1

---

<div class="post-metadata">

### Author: ![veve90](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/veve90/32/6517_2.png) [@veve90](https://discuss.elastic.co/u/veve90)
#### Post date: [February 24, 2016, 5:00pm UTC](https://discuss.elastic.co/t/missing-authentication-token-for-rest-request/39779/7 "2016-02-24T17:00:46Z")

</div>

I'm having the same issue:  
CentOS 7  
elasticsearch 2.0.1  
logstash 2.0.0  
kibana 4

I updated to  
elasticsearch 2.2.0  
logstash 2.2.2  
kibana 4.2.0

and I still have the issue

---

<div class="post-metadata">

### Author: ![veve90](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/veve90/32/6517_2.png) [@veve90](https://discuss.elastic.co/u/veve90)
#### Post date: [February 25, 2016, 10:14am UTC](https://discuss.elastic.co/t/missing-authentication-token-for-rest-request/39779/8 "2016-02-25T10:14:08Z")

</div>

Note. In my case, with the last version of everything, on a centos, I have still habe this as logs in elasticsearch, but in kibana the roles are working as expected..

Can this error be generated if we have a dashboard with multiple indices, and we have access only to one part of them?

---

<div class="post-metadata">

### Author: ![jaymode](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jaymode/32/50103_2.png) [@jaymode](https://discuss.elastic.co/u/jaymode)
#### Post date: [February 25, 2016, 11:27am UTC](https://discuss.elastic.co/t/missing-authentication-token-for-rest-request/39779/9 "2016-02-25T11:27:55Z")

</div>

This exception may occur in normal operation. What happens is a browser/client will send a request to a server without authentication credentials and then you get the missing authentication token exception, which will return to the browser/client as a challenge for authentication. This causes the client to request credentials from the user (basic auth popup in a browser) and send them back to the server.

---

<div class="post-metadata">

### Author: ![Yasho](https://avatars.discourse-cdn.com/v4/letter/y/c2a13f/32.png) [@Yasho](https://discuss.elastic.co/u/Yasho)
#### Post date: [May 4, 2016, 11:33am UTC](https://discuss.elastic.co/t/missing-authentication-token-for-rest-request/39779/10 "2016-05-04T11:33:45Z")

</div>

Guys,

Having the same issue, did anyone figure out the solution ? I saw some people just upgraded and it worked and for some like above it did not. Also it there any specific reason for this issue to happen?

---

<div class="post-metadata">

### Author: ![smitjainsj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smitjainsj/32/7655_2.png) [@smitjainsj](https://discuss.elastic.co/u/smitjainsj)
#### Post date: [May 17, 2016, 5:09pm UTC](https://discuss.elastic.co/t/missing-authentication-token-for-rest-request/39779/11 "2016-05-17T17:09:53Z")

</div>

I reset my password for the user "es\_admin" and also created new user as per below with the role "kibana4\_server"

bin/shield/esusers useradd alpha -r kibana4\_server -p xxxxxxx

Then I restart the elastic-search and did worked for me.

---

<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: [July 6, 2017, 1:44pm UTC](https://discuss.elastic.co/t/missing-authentication-token-for-rest-request/39779/12 "2017-07-06T13:44:36Z")

</div>


