Discussion:
Web Interface Authentication
Al
2011-05-04 18:46:46 UTC
Permalink
hi,

I'm having trouble authenticating when using the web interface. I can access
the main page at port 28017, but when I try to use the web interface to
query a specific collection I get an unauthorized db error (error code
10057). We have authentication enabled for our server, I've read the Http
Interface docs, but I can't figure out the actual syntax or steps to perform
authentication. We're running 1.8.0 on 64 bit CentOS 5.5. Any suggestions
welcome.

cheers,
Alan
--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongodb-user-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to mongodb-user+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
Gaetan Voyer-Perrault
2011-05-04 19:01:05 UTC
Permalink
MongoDB uses Basic http authentication.

If you try to access port 28017 with authentication, you will be asked to
authenticate. Your browser will pop up a little window and ask you for user
name and password.
but when I try to use the web interface to query a specific collection I
get an unauthorized db error (error code 10057)

Does this database have separate authentication on it?
What command(s) are you running exactly?
Does it behave correctly from localhost?

Any steps you can provide to reproduce what you're seeing would be helpful.

- Gates
hi,
I'm having trouble authenticating when using the web interface. I can
access the main page at port 28017, but when I try to use the web interface
to query a specific collection I get an unauthorized db error (error code
10057). We have authentication enabled for our server, I've read the Http
Interface docs, but I can't figure out the actual syntax or steps to perform
authentication. We're running 1.8.0 on 64 bit CentOS 5.5. Any suggestions
welcome.
cheers,
Alan
--
You received this message because you are subscribed to the Google Groups
"mongodb-user" group.
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/mongodb-user?hl=en.
--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongodb-user-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to mongodb-user+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
Al
2011-05-04 19:28:40 UTC
Permalink
Thanks for the reply.

I was expecting the popup, but didn't get one. I tried using Chrome,
Firefox, and IE, and got the same error in each case. I did hit another site
using basic http auth and got a popup there as expected.

The database does have separate authentication on it. I access it regularly
using the Java driver, and authenticate with no issues, this is my first
time trying web authentication.

The URL I'm trying is <host>:28017/db/collection, and various permutations
of <host>:28017/db/collection/?filter_a=1 etc. The server is started using
the command "mongod --fork --journal --auth --rest --dbpath /data/db
--logpath /var/log/mongodb/mongod.log --logappend". The log message
corresponding to the previous access is:
Wed May 4 19:18:19 [websvr] assertion 10057 unauthorized db:db lock type:-1
client:0.0.0.0 ns:db._defaultCollection query:{}
Wed May 4 19:18:19 [websvr] ntoskip:0 ntoreturn:1000

I get the same error message from localhost, trying to access using "curl
--user user:pass http:<host>:28017/db/collection". (I can't run a browser
locally.)
--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongodb-user-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to mongodb-user+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
Greg Studer
2011-05-04 21:20:36 UTC
Permalink
This may have to do with some weirdness in the way your url is parsed by
mongodb - can you show the response headers with curl -I --user
user:pass <address>? (the namespace and action should be included)

Also, is "collection" literally the collection name or is it just a
placeholder?
Post by Al
Thanks for the reply.
I was expecting the popup, but didn't get one. I tried using Chrome,
Firefox, and IE, and got the same error in each case. I did hit
another site using basic http auth and got a popup there as expected.
The database does have separate authentication on it. I access it
regularly using the Java driver, and authenticate with no issues, this
is my first time trying web authentication.
The URL I'm trying is <host>:28017/db/collection, and various
permutations of <host>:28017/db/collection/?filter_a=1 etc. The server
is started using the command "mongod --fork --journal --auth --rest
--dbpath /data/db --logpath /var/log/mongodb/mongod.log --logappend".
Wed May 4 19:18:19 [websvr] assertion 10057 unauthorized db:db lock
type:-1 client:0.0.0.0 ns:db._defaultCollection query:{}
Wed May 4 19:18:19 [websvr] ntoskip:0 ntoreturn:1000
I get the same error message from localhost, trying to access using
"curl --user user:pass http:<host>:28017/db/collection". (I can't run
a browser locally.)
--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To unsubscribe from this group, send email to mongodb-user
For more options, visit this group at
http://groups.google.com/group/mongodb-user?hl=en.
Greg Studer
2011-05-04 21:23:40 UTC
Permalink
Also, know you've done a bunch of tests yourself, but what about adding
just a trailing "/"?
Post by Al
Thanks for the reply.
I was expecting the popup, but didn't get one. I tried using Chrome,
Firefox, and IE, and got the same error in each case. I did hit
another site using basic http auth and got a popup there as expected.
The database does have separate authentication on it. I access it
regularly using the Java driver, and authenticate with no issues, this
is my first time trying web authentication.
The URL I'm trying is <host>:28017/db/collection, and various
permutations of <host>:28017/db/collection/?filter_a=1 etc. The server
is started using the command "mongod --fork --journal --auth --rest
--dbpath /data/db --logpath /var/log/mongodb/mongod.log --logappend".
Wed May 4 19:18:19 [websvr] assertion 10057 unauthorized db:db lock
type:-1 client:0.0.0.0 ns:db._defaultCollection query:{}
Wed May 4 19:18:19 [websvr] ntoskip:0 ntoreturn:1000
I get the same error message from localhost, trying to access using
"curl --user user:pass http:<host>:28017/db/collection". (I can't run
a browser locally.)
--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To unsubscribe from this group, send email to mongodb-user
For more options, visit this group at
http://groups.google.com/group/mongodb-user?hl=en.
Continue reading on narkive:
Loading...