Couchbase REST API from spring boot application - certificate authentication error


I am trying couchbase REST API (https://<couchbase_host>:18091/pools/nodes) from spring boot application with RestTemplate, for authentication I am using client certificate. I have enabled client authentication from couchbase web console.
I am getting 401 unauthorized error. Can someone please help.


@rohityewale 401 (Unauthorized) should mean that the credentials supplied (username and/or password) are invalid, however, due to confusing documentation of HTTP error codes in HTTP itself, some components may return this where 403 (Forbidden) would be more accurate, i.e. where the credentials were good but the user does not have permission to access the requested resource. Thus these are the primary things to check.

Hi Kevin,
Thanks for your reply. I am passing client certificate when i do rest template call to rest api.
the certificate has username which is present as full admin in couchbase.
Not sure why its giving 401 unauthorised error.
Any idea please.


@rohityewale I am not familiar with the certificate approach as Couchbase REST access is not my area expertise. I usually test REST APIs via curl, where credentials are passed as flag

-u username:password

You could check if curl is able to access the REST API, e.g.

curl -X GET -u username:password “https://<couchbase_host>:18091/pools/nodes”

If so then I’m guessing the problem in your original approach might be something like expired or incorrect certificate. If curl is also blocked perhaps there is a firewall blocking port 18091.