authenticationpermissionscouchdbfauxton

cochdb permissions roles always "not authorized"


I try to make a user / role authentication (session based) with CouchDB but as soon as I enter a role at a database all users and roles are can access the database -> the are not authorized.

Get the session:

POST http://myhost:1234/_session

It returns (the userCtx object):

{
    "ok": true,
    "name": "some_user_name",
    "roles": [
        "developers"
    ]
}

Then I added the roles to the database:

PUT http://myhost:1234/database/_security

{
    "admins": {
        "names": [],
        "roles": []
    },
    "members": {
        "names": [],
        "roles": [
            "developers"
        ]
    }
}

and it returns {"ok":true} and I can see the permissions also in fauxton.

When I now try to access the database with

GET http://myhost:1234/database/_all_docs

it returns:

{
    "error": "unauthorized",
    "reason": "You are not authorized to access this db."
}

Solution

  • ahhh I found the mistake, I was doing the tests with postman and there I did not recognized that the credentials was not send with the requests :-(