3

I am using the HTTP API for ArangoDB 2.6 (but I believe I encountered the problem I am about to describe in previous versions as well).

  1. I authenticate with ArangoDB with user/passwd (root or an existing user).
  2. I create a new database with the same user/passwd.
  3. When I try to access the newly created database with the same user/passwd, I get a 401 (Unauthorized).

When I try to use the web dashboard instead I run into a similar problem where I get kicked back to the login screen and can't log in anymore when I try to access a database page. Am I doing something wrong? Could this be a bug? Thanks in advance.

1 Answer 1

5

The following seems to work in 2.6 with authentication turned on. It uses the HTTP REST API with curl:

First of all, we need to verify that we can actually connect to the _system database with a privileged user. We need this in order to create a new database:

curl --dump - --basic --user "root:rootpasswd" -X GET \
  http://127.0.0.1:8529/_db/_system/_api/version && echo

This should return an HTTP 200. Now that we can connect to the _system database, we can issue a call to create a new database, named "testdb". We'll create a user named "testuser" and password "test1234" to connect to it:

curl --dump - --basic --user "root:rootpasswd" -X POST \
  http://127.0.0.1:8529/_db/_system/_api/database \
  --data '{"name":"testdb","users":[{"username":"testuser","passwd":"test1234"}]}' && echo

This should have returned an HTTP 201.

Now we can finally check that we can actually connect to the just created database with the new user:

curl --dump - --basic --user "testuser:test1234" -X GET \
  http://127.0.0.1:8529/_db/testdb/_api/version && echo

This should return HTTP 200 as well, meaning that you can connect to the just created database with the new user.

Please check whether this works for you, too.

Sign up to request clarification or add additional context in comments.

3 Comments

Yes it seems to be working now. I do not know why it didn't work that time and cannot reproduce the problem. I will let you know if I run into the issue again. Thanks!
Thanks for confirming. If the issue pops up again, let us know.
All the steps seem to be working on my side, but when it comes to the code on a production environment it stays shows [HTTP 401][ERR 11] not authorized to execute this request error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.