Perhaps a bug with new (Couchbase 5) PasswordAuthenticator


I stumble upon a strange behavior when trying to open a bucket using PasswordAuthenticator.

First of all, if I specify correct user name and incorrect password I’m getting an error:
"Authentication failed for bucket ‘userName’“
I expected to see there a bucket name I was trying to open and perhaps something like
"Authentication failed for user ‘userName’”

But the real problem is when I initiate cluster configuration using app.config. In this case, I cannot open a bucket using authenticator. However, if I run almost identical code, where I create new cluster and only set server list for it, everything is working as expected and I can open a bucket with correct credentials.

How to replicate (code that produces exception):

Cluster cluster = new Cluster(configurationSectionName: "couchbaseClients/couchbase");
var auth = new Couchbase.Authentication.PasswordAuthenticator(userName, password);
return cluster.OpenBucket(bucketName);

“Could not bootstrap - check inner exceptions for details.”
“One or more errors occurred.”

The same bucket and the same credentials can open a bucket successfully if initialized like this:

Cluster cluster = new Cluster(
  new Couchbase.Configuration.Client.ClientConfiguration() {
    //Servers = _Cluster.Configuration.Servers - it works too, here _Cluster is initialized using app.config
    Servers = new List<Uri> { new Uri("") }
var auth = new Couchbase.Authentication.PasswordAuthenticator(userName, password);

App.config related to couchbase is:

    <sectionGroup name="couchbaseClients">
      <section name="couchbase" type="Couchbase.Configuration.Client.Providers.CouchbaseClientSection, Couchbase.NetClient" />

    <couchbase useSsl="false">
        <add uri=""></add>
        <add name="xxxxx" password="*******">
          <connectionPool name="custom" maxSize="10" minSize="5" sendTimeout="12000">< /connectionPool>

Any advises what is the difference between initializing a cluster from app.config and directly from the code?

@alex.bugrimenko -

Yes, I suspect that you have just stumbled upon a couple of bugs in the implementation of RBAC. I created a couple Jira tickets for tracking:

If you feel inclined to fix on your own, please send a PR, otherwise this should be fixed in 2.4.7 or 2.4.8.


1 Like

Hi @alex.bugrimenko

I haven’t been able to reproduce the bootstrap error you have experienced using your code examples for trying to load config using a config section, please can you verify your code examples are correct?

I have added tests to ensure using a config section works for both PasswordAuthenticator and ClassicAuthenticator in this commit.