couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bharat <bharat.kj...@gmail.com>
Subject Re: jcouchdb anyone?
Date Wed, 28 Apr 2010 19:05:49 GMT
Couchdb log:
--------------------
[debug] [<0.112.0>] 'GET' /<my db name> {1,1}
Headers: [{'Connection',"Keep-Alive"},{'Host',"localhost:5984"}]
[debug] [<0.112.0>] OAuth Params: []
[debug] [<0.112.0>] Not a reader: UserCtx {user_ctx,null,[],undefined} vs
Names [<<"<my username>">>] Roles [<<"_admin">>]
[debug] [<0.112.0>] Minor error in HTTP request: {unauthorized,
                                 <<"You are not authorized to access this
db.">>}
[debug] [<0.112.0>] Stacktrace: [{couch_db,open,2},
             {couch_httpd_db,do_db_req,2},
             {couch_httpd,handle_request_int,5},
             {mochiweb_http,headers,5},
             {proc_lib,init_p_do_apply,3}]
[info] [<0.112.0>] 127.0.0.1 - - 'GET' /<my db name> 401
[debug] [<0.112.0>] httpd 401 error response:
 {"error":"unauthorized","reason":"You are not authorized to access this
db."}


-------------------------------
[log]
file = /usr/local/var/log/couchdb/couch.log
level = debug

[couch_httpd_auth]
authentication_db = _users
require_valid_user = false
------------------------------

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

code again:
ServerImpl service = new ServerImpl("localhost");
Credentials credentials =
            new UsernamePasswordCredentials(<my username>, <pass>);
AuthScope authScope = new AuthScope("http://localhost", 5984);
service.setCredentials(authScope, credentials);

Response res = service.get(/<my db name>);

--------------

Thanks Chris

On Wed, Apr 28, 2010 at 11:06 AM, J Chris Anderson <jchris@gmail.com> wrote:

>
> On Apr 28, 2010, at 10:33 AM, Bharat wrote:
>
> > I am trying to use jcouchdb api for authenticating against my couchdb
> > instance(0.11). I have set the admin usr/pass in futon and in addition
> > specified ADMIN and READER on the DB I am trying to access so only people
> > with correct credentials can access/view the DB.
> >
> > My code is pretty simple and directly using ServerImpl and its
> > setCredentials and get method:
> >
> > -------------------------
> > ServerImpl service = new ServerImpl("localhost");
> >        Credentials credentials =
> >                new UsernamePasswordCredentials(<usr>, <pass>);
> >        AuthScope authScope = new AuthScope("http://localhost", 5984);
> >
> >        service.setCredentials(authScope, credentials);
> >
> >        Response res = service.get(/<database>);
> > -----------------------------
> >
> > But everytime I do this, I keep getting http 401 in my response. Is there
> > something I am missing or not setting correctly?
> >
>
> If you can give us the logs from CouchDB (at debug level) or an HTTP-level
> transcript of what's happening, we can probably help better with debugging.
>
> Chris
>
> > I know its not exactly a couchdb question but there is very little to no
> > documentation available so thought I ll try here.
> >
> > Thanks!
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message