Issue
I'm trying to list data from Elastic Search using the REST API on Postman.
But I get a security_exception
error
I read the elastic documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-token.html but didn't work.
I'm using Elastic 7.2
Method: POST
Content-type: Application/json
URI: http://xxx.xxx.xxx.xxx:9200/_security/oauth2/token
BODY:
{
"grant_type" : "password",
"username" : "user_name",
"password" : "correct_password"
}
I need this service to return the authentication token. But this is the response:
{
"error": {
"root_cause": [
{
"type": "security_exception",
"reason": "missing authentication credentials for REST request [/_security/oauth2/token]",
"header": {
"WWW-Authenticate": "Basic realm=\"security\" charset=\"UTF-8\""
}
}
],
"type": "security_exception",
"reason": "missing authentication credentials for REST request [/_security/oauth2/token]",
"header": {
"WWW-Authenticate": "Basic realm=\"security\" charset=\"UTF-8\""
}
},
"status": 401
}
Solution
Try to do a basic authentication instead. And pass in the body just the grant_type.
Answered By - Eduardo de Santana Answer Checked By - David Marino (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.