Error when I want to get an access token

Hello,
I'm starting to use ElasticSearch and I try to get a token access. For this, I use postman to test this request.

method : POST
endpoint : https://myID.europe-west1.gcp.cloud.es.io:9243/_security/oauth2/token
body JSON : { "grant_type" : "client_credentials" }
OR body JSON : { "grant_type" : "password", "username" : "elastic", "password" : "mypasswd" }

When I send my request I get this error:

"error": {
    "root_cause": [
        {
            "type": "security_exception",
            "reason": "action [cluster:admin/xpack/security/token/create] requires authentication",
            "header": {
                "WWW-Authenticate": [
                    "Bearer realm=\"security\"",
                    "ApiKey",
                    "Basic realm=\"security\" charset=\"UTF-8\""
                ]
            }
        }
    ],
    "type": "security_exception",
    "reason": "action [cluster:admin/xpack/security/token/create] requires authentication",
    "header": {
        "WWW-Authenticate": [
            "Bearer realm=\"security\"",
            "ApiKey",
            "Basic realm=\"security\" charset=\"UTF-8\""
        ]
    }
},
"status": 401
}

By default, xpack is installed on ElasticSearch, isn't it? Or, do I need to set more settings?

Thanks for your help.

The basic authentication in the request header did not seem correct. After correcting the code, I can get an access token. I close this issue...

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