Couchbase bucket with password is not working in couchbase server 4.0

I am using couch base server 4.0 community Edition

Issue: Couch base bucket with password is not working means i could not able to access in couch base server 4.0

Hi there,
Are you setting the password when initializing couchbase configuration?


        <add uri="" />
        <add name="xxxx" password="????" />


_bucket = _cluster.OpenBucket(CouchbaseBucket, CouchbaseBucketPassword);

Hi Rafael,

Thanks for your reply

My web.config

<couchbase Bucket="bucketName" BucketPassword="????" CacheKeyPrefix="prefix">
    <Server Host="" />
  <Pool MinSize="2" MaxSize="5" />
</couchbase >

Thank you Rafael its working.

one more question how to used bucket password with N1QL query

In the Java client the Bucket object from which you call query() are automatically added to the HTTP request headers.

But I think in the .NET client, the credentials are expected to be injected in the request body for the query service to consume, via QueryRequest.AddCredentials.

The problem is there is a bug in 4.0/4.1 that fails to take these credentials into account :bug: :frowning:
See MB-16964.

@jmorris do you know about a workaround for that particular problem?

@balaji.j @rafael.felix @simonbasle -

QueryRequest.AddCredentials won’t work until MB-16964 is fixed on the server, however the workaround is to just use the bucket credentials and limit your query scope to the bucket you are authenticated against:

So, basically this:

bucket = _cluster.OpenBucket("mybucket", CouchbaseBucketPassword);
var result = bucket.Query(new QueryRequest("SELECT * FROM `mybucket`;"));

is all you need to do to query against an authenticated bucket assuming your client version >= 2.2.4.


Its working fine :slight_smile: Thank you