我想使用其 API“ https://cloud.mongodb.com/api/atlas/v1.0/groups ”获取MongoDB 中的项目列表,但每次我收到错误消息“401 您无权使用此资源” ”。
根据文档摘要认证被使用。
似乎我以错误的方式传递 Private_key 和 Public_key 。
下面是我的请求对象
{
url: 'https://cloud.mongodb.com/api/atlas/v1.0/groups',
method: 'GET',
headers: {
'Accept': 'application/json',
},
auth: {
user: 'Public_Key',
pass: 'Private_key'
}
}
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮我解决这个问题。
authentication mongodb digest-authentication node.js mongodb-atlas