Hey, I’m trying to create a database user in MongoDB Atlas using the Administrative API, but I keep encountering a 401 Unauthorized error.
Here’s the command I’m using:
curl --request POST “https://cloud.mongodb.com/api/atlas/v1.0/groups//databaseUsers”
–user “:”
–header “Content-Type: application/json”
–data ‘{
“databaseName”: “$external”,
“groupId”: “”,
“roles”: [
{
“databaseName”: “test”,
“roleName”: “readWrite”
}
],
“username”: “CN=test_user”,
“x509Type”: “CUSTOMER”
}’
The API keys I’m using have Project Owner access, I get the following
error:{ "error" : 401, "reason" : "Unauthorized", "detail" : "You are not authorized for this resource." }