获取 IBM Cloudant http log "unauthorized"?



我创建了一个 IBM Cloudant 数据库,并尝试通过基于 Legacy HTTP Cookie 的身份验证进行连接,但失败并显示 401 代码。

为什么这失败了,因为我正确地遵循了每一步?

请求:

url:
'https://<username>.cloudant.com/_session',
method: 'POST',
json: true,
body:
{ name: '<username>',
password: '<apiKey>' },

响应:401 未授权

{
"error": "unauthorized",
"reason": "Name or password is incorrect."
}

裁判:

https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-authentication#cookie-authentication

https://developer.ibm.com/technologies/node-js/tutorials/end-to-end-nodejs-application-with-loopback-4-cloudant-and-angular/

使用IBM Cloud IAM,通常,如果您需要提供用户名/密码,则可以使用"apikey"作为用户名,并使用实际的 API 密钥作为密码。或者,如果您的凭据同时包含 API 密钥和密码,则传递用户名和包含的密码。

使用用户名和 API 密钥作为密码应该会导致错误。

最新更新