繁体   English   中英

如何使用 REST API 获取身份验证令牌或登录 Elastic Search? 例如来自邮递员

[英]How I can get authentication token or do loging in Elastic Search using REST API? For example from POSTMAN

我尝试使用 POSTMAN 的 REST API 从 Elastic Search 中列出数据。 但我有“security_exception”

我从https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-token.html阅读了弹性文档,但没有用。

我正在使用弹性 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"
}

我需要此服务返回身份验证令牌。 但这是回应:

{
    "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
}

尝试进行基本身份验证。 并在正文中传递grant_type。

在此处输入图片说明

在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM