0

I have protected my Couchdb database for access with a username. The access via curl https://user:password@url:port/dbname works fine. If I put this in the browser via url or using Javascript with CouchJS it works not (Error 401). I have enabled CORS in the CouchDB-config.

Can anyone help me, please.

1 Answers1

0

If pasting the same URL you used with curl into the address bar of your browser doesn't work, then you may have a different problem. However, if you're just having trouble making AJAX requests against a CouchDB (which has CORS enabled) you probably need to set the Authorization header. See the answers to this question: How to use Basic Auth with jQuery and AJAX?

Community
  • 1
  • 1
David Noël
  • 117
  • 3
  • Thanks for your answer. I think, that is the same, if I paste the curl string in the browser-url. For my JavaScript-App I use the CouchDB jQuery-Plugin [couchdb-jquery-plugin][1], and there is not possible to set the Authorization header ([see here][2]). What can I do? [1]: http://bradley-holt.com/2011/07/couchdb-jquery-plugin-reference/ [2]: http://stackoverflow.com/questions/19861847/couchdb-jquery-api-add-authorization-header – Bunte Berte Feb 18 '15 at 16:59