This repository was archived by the owner on Dec 10, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 107
Authentication
kchodorow edited this page Aug 28, 2012
·
5 revisions
Note: authenticating is only required if you're using MongoDB with authentication enabled.
http://localhost:27080/dbname/_authenticate
Authenticates a connection. Authentication is required before sending any reads or writes to a database started with --auth
or --keyFile
.
Once a connection is authenticated, it will remain authenticated until it is closed. Thus, reads and writes can be run normally.
POST
Required arguments:
-
username=username
(string) -
password=password
(string)
Optional arguments:
None.
On success:
{"ok" : 1}
On failure, an error message will be returned.
Logging into the foo
database.
$ curl --data 'username=someUser&password=mySecretPassword' 'http://localhost:27080/foo/_authenticate'
{"ok" : 1}
$ # now this will work:
$ curl --data 'docs=[{"x":1}]' 'http://localhost:27080/foo/bar/_insert'
$ # this will not (wrong database):
$ curl --data 'docs=[{"x":1}]' 'http://localhost:27080/baz/bar/_insert'