Giter Site home page Giter Site logo

Comments (10)

inceptivetech avatar inceptivetech commented on May 14, 2024 2

Ooooo
thanks for your help. I should have contacted you first. Any way thanks again. Much appreciated.

Regards,
Suhas

from couchdb.

wohali avatar wohali commented on May 14, 2024 1

Your step 1 talking to port 5986 to create a user is wrong - you got bad advice.

You need to first create the _users database on port 5984 as outlined in our setup documentation: http://docs.couchdb.org/en/latest/install/setup.html#single-node-setup

Once you have created the _users database through port 5984, repeat your step 1 to create your user on port 5984.

Then everything else should work normally.

from couchdb.

wohali avatar wohali commented on May 14, 2024

This is not a bug.

You should be doing everything with CouchDB using port 5984. The only thing that should be done via port 5986 is cluster setup tasks as explicitly outlined in our documentation.

from couchdb.

inceptivetech avatar inceptivetech commented on May 14, 2024

Thanks for your response.
However I tried following API on 5984
curl -X PUT http://admin:*****@localhost:5984/_users/org.couchdb.user:dan -H "Accept: application/json" -H "Content-Type: application/json" -d '{"name": "dan", "password": "apple", "roles": [], "type": "user"}'

it results in below message
{"error":"not_found","reason":"Database does not exist."}

Same was working on port 5986. Not able to understand what is the issue with port 5984

from couchdb.

wohali avatar wohali commented on May 14, 2024

You need to run all of your commands against port 5984. That error says your database was not created through the clustered interface.

If you are upgrading from couchdb 1.x you can migrate your database with these steps: http://docs.couchdb.org/en/latest/install/upgrading.html

from couchdb.

inceptivetech avatar inceptivetech commented on May 14, 2024

thanks again.
It was a fresh installation of couchdb 2.0.0, so there was no upgrade. I am using MAC, do you think re-installing couchdb will solve this problem.

Regards,
Suhas

from couchdb.

wohali avatar wohali commented on May 14, 2024

No need to reinstall. Just start over with:

curl -X PUT http://localhost:5984/eventdb

to create your database first.

from couchdb.

inceptivetech avatar inceptivetech commented on May 14, 2024

Thank you.

Started over, deleted eventdb and recreated one, however same issue exists. Added _security document to eventdb and assign an user to it and when tried
curl -u fan:apple http://localhost:5984/eventdb

it results in

{"error":"unauthorized","reason":"Name or password is incorrect."}

from couchdb.

wohali avatar wohali commented on May 14, 2024

Can you paste the entire set of things that you try? Is your user:password that you show there a CouchDB admin (listed in [admins] section of local.ini?)

from couchdb.

inceptivetech avatar inceptivetech commented on May 14, 2024

Hi,
Objective : is to create an user which will be in _users collection and then provide eventdb member access to the user.

things I tried out

  1. For adding user

curl -X PUT http://admin:*****@localhost:5984/_users/org.couchdb.user:dan -H "Accept: application/json" -H "Content-Type: application/json" -d '{"name": "dan", "password": "apple", "roles": [], "type": "user"}'

which results in below message
{"error":"not_found","reason":"Database does not exist."}

I searched on google for this error and come to know that system collection like _users are moved to port 5986 hence I fired below api

curl -X PUT http://admin:*****@localhost:5986/_users/org.couchdb.user:dan -H "Accept: application/json" -H "Content-Type: application/json" -d '{"name": "dan", "password": "apple", "roles": [], "type": "user"}'
I was able to create an user. (please note port number 5986)

  1. Provide eventdb member access to dan

I executed below command to provide an access
curl -X PUT http://localhost:5984/eventdb/_security -u admin:***** -H "Content-Type: application/json" -d '{"admins": { "names": [], "roles": [] }, "members": { "names": ["dan"], "roles": [] } }'
which returns below result for me

{"ok":true}
3. Accessing eventdb using dan's credential

curl -u dan:apple http://localhost:5984/eventdb

it results in
{"error":"unauthorized","reason":"Name or password is incorrect."}

I was following documentation at http://docs.couchdb.org/en/2.0.0/intro/security.html

thanks for your help.

from couchdb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.