Authentication failed for m103-application-user

Am I typing a wrong password?

MongoDB Enterprise > use admin
switched to db admin
MongoDB Enterprise > db.getUsers()
[
{
“_id” : “admin.m103-admin”,
“user” : “m103-admin”,
“db” : “admin”,
“roles” : [
{
“role” : “root”,
“db” : “admin”
}
]
},
{
“_id” : “admin.m103-application-user”,
“user” : “m103-application-user”,
“db” : “admin”,
“roles” : [
{
“role” : “readWrite”,
“db” : “applicationData”
}
]
}
]
MongoDB Enterprise > db.auth(m103-application-user, m103-applicationr-pass)
2019-02-18T18:13:43.711+0000 E QUERY [thread1] ReferenceError: m103 is not defined :
@(shell):1:1
MongoDB Enterprise > db.auth(“m103-application-user”, “m103-application-pass”)
Error: Authentication failed.
0

The reason being the space at the very begin of the password in the createUser command:
MongoDB Enterprise > db.createUser({ user: “m103-application-user”, pwd: " m103-application-pass", roles: [ { db: “applicationData”, role: “readWrite” } ]})
Successfully added user: {
“user” : “m103-application-user”,
“roles” : [
{
“db” : “applicationData”,
“role” : “readWrite”
}
]
}

modified using db.changeUserPassword(“m103-application-user”, “m103-application-pass”), works as a charm now

1 Like