ArangoDB authentication over HTTP

I saw examples of database authentication using arangosh, but I could not find anything in the documentation on how to authenticate using the http API. Is it possible? This is something like this:

http: // username: passwd@arangouri.com : 8529 / _api / document

+7
authentication arangodb
source share
3 answers

Well, after playing with authentication in the Arango database on Windows, this is what I found:

I could not get this command to work (which should include authentication)

--server.disable-authentication false 

UPDATE: I realized that I can not get this command to work, because it is not a command at all: -o After a closer look at the documentation, this is a command line parameter. It should be used when starting arangosh. See here .

I assume that I need to somehow adapt it to work on the Windows command line, but I'm not sure what needs to be changed. As a job, I opened the file "arangod.conf" (I found C: \ Program Files (x86) \ ArangoDB 1.4.7 \ etc \ arangodb here) and changed the following line:

 disable-authentication = yes 

to

 disable-authentication = no 

This activated authentication when restarting Arango. Hooray!

Now for authentication via http ... very simple. This is just basic HTTP authentication. So in my case, I used NodeJS and a request library for authentication. Both examples below work fine.

Credentials added using .auth:

 request({ url:'http://localhost:8529/_api/document/example/20214484', json: true }, function (err, data){ console.log(err); if (data.body.error) console.log("ERROR: " + data.body.errorMessage); console.log(data.body); }).auth("username", "password"); 

OR with credentials in the URL:

 request({ url:'http://username: password@localhost :8529/_api/document/example/20214484', json: true }, function (err, data){ console.log(err); if (data.body.error) console.log("ERROR: " + data.body.errorMessage); console.log(data.body); }); 
+5
source

At the command line, you can do something like this to pass the basic HTTP authentication to the server:

 curl --basic --user "username:passwd" -X GET http://arangouri.com:8529/_api/document/... 

The above example is for curling. If you use any other HTTP client, you need to find the parameters for setting the username / password for basic HTTP authentication and sending them to the server.

+4
source

This is done through the Authorization header, where you set up an authentication mechanism (for example, Basic), followed by a base64 encoded string in the format [username]:[password] . More information can be found, for example, here .

+2
source

All Articles