I can't access my couchdb instance it using curl or any third party CouchDB client library..
It returns: 401 Unauthorized!
I am using the url
https://instance.smileupps.com/
Using curl this is the command line I entered:
curl https://instance.smileupps.com/
"401 Unauthorized" means that your instance is not in admin party (you have already specified at least one administrator credentials pair).
In this case you should send an authenticated request, both with curl or with any third party client side library.
1) THE EASY WAY (doesn't work with credentials with special characters)
You can use a modified url by prefixing the hostname with username:password like:
https://my_username:[email protected]
This works fine almost always..
2) THE TRICKY BUT SAFER WAY (More reliable and safer)
If 1) does not work, probably you are using special characters within your username or password, and curl or the couchdb library cannot correctly parse the url before sending the request.
In this case you can perform authentication by sending the http basic authorization header... that is a header like:
Authorization: Basic bXlfdXNlcm5hbWU6bXlfcGFzc3dvcmQ=
where "bXlfdXNlcm5hbWU6bXlfcGFzc3dvcmQ=" is the base64_encode of "my_username:my_password". You can use the base64 online encoder service to encode your own credentials.
So the curl command line would become something like:
> curl -v -H "Authorization: Basic bXlfdXNlcm5hbWU6bXlfcGFzc3dvcmQ=" -H
> "Content-type:application/json" -X GET
> https://instance.smileupps.com/mydatabasename
If you are using a third party library instead, you should find in its documentation the way to add a custom header, and add the following:
Authorization: Basic bXlfdXNlcm5hbWU6bXlfcGFzc3dvcmQ=
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With