使用“查询”http api 后获取 "code":"unauthorized","message":"unauthorized
Posted
技术标签:
【中文标题】使用“查询”http api 后获取 "code":"unauthorized","message":"unauthorized access"【英文标题】:getting "code":"unauthorized","message":"unauthorized access" after using "query" http api使用“查询”http api 后获取 "code":"unauthorized","message":"unauthorized access" 【发布时间】:2021-12-14 16:04:50 【问题描述】:我正在尝试联系在 kubernetes 上运行的 influxdb。我是 influxdb 的新手,我刚刚开始使用它。我通过以下方式使用查询http API:curl "http://pod_ip_address/query?q=show+databases"
,但响应为"code":"unauthorized","message":"unauthorized access"
。现在我只有用户 UI,所以问题可能与此有关。有人知道可能是什么问题吗?
【问题讨论】:
【参考方案1】:InfluxDB 2.0 需要使用 ORG 和 Token 进行身份验证。您可以在 curl
调用中将这些作为 HTTP 标头传递,如下所示:https://docs.influxdata.com/influxdb/v2.0/api-guide/api_intro/#authentication
【讨论】:
以上是关于使用“查询”http api 后获取 "code":"unauthorized","message":"unauthorized 的主要内容,如果未能解决你的问题,请参考以下文章