Unable to Authenticate with Couchbase Server 5.0 and SDK 2.7

I am working on getting our system updated from Couchbase Server 4.6 to Couchbase Server 5.0.

We’re using Sync Gateway 2.5 and CouchbaseNetClient 2.7.27

I’m struggling to our website authenticated and connected to the bucket. The Sync Gateway authentication works correctly, and our mobile app is working with it.

However, our C# backend keeps having authentication issues:

Could not bootstrap with CCCP. (Authentication failed for bucket 'dev') ---> System.Security.Authentication.AuthenticationException: Authentication failed for bucket 'dev'

This is the same code that worked for 4.6, so I’m assuming that 5.0 requires different authentication to work.

I have spent the last 2 - 3 days trying to figure out how this is done. The documentation here:

Says to use this:

var cluster = new Cluster(new ClientConfiguration
{
    Servers = new List<Uri> { new Uri("http://10.112.170.101") }
});

var authenticator = new PasswordAuthenticator("username", "password");
cluster.Authenticate(authenticator);
var bucket = cluster.OpenBucket("bucketname");

However, I keep getting the following errors:

The type or namespace name 'Cluster' could not be found (are you missing a using directive or an assembly reference?)

The type or namespace name 'PasswordAuthenticator' could not be found (are you missing a using directive or an assembly reference?)

I’m not sure what more to do. Every example I find for 2.x says to use this code, but I can’t find anything online about people having issues with it not working. If there is a using statement I’m missing, I can’t find documentation on which Namespace these exist in.

Any help getting this working would be highly appreciated.

Thanks

The error message is a compilation error. Did you install the SDK first? If you show the commands you used and the output of the commands, someone may be able to help.

I’m sure you’re already aware, but CB server 5.0 and SDK 2.7 are very old

Yeah, I know they’re compilation errors. I just don’t know how to get around them, or how to get them to compile. If they’re part of a different namespace, I can’t seem to find any documentation online as to what namespace they’re part of.

The SDK is installed, and works with the older version of Couchbase. Just not those two commands.

And yes, I’m aware they’re older versions. However, we’re currently using 4.6! lol
So, this is a multi-step process. Going straight to 7.x Couchbase is a bit of a jump right now as it would take a bit of code rewrites.

However, SDK 2.7.27 is only 2022, so I would think there should be some info on it that I can use.

Thanks!

And see the devguide examples in link in that section …

I don’t know why it would have changed. You may want to check the connectivity with SDK Doctor.

From what I recall reading, 5.0 introduced more specific authentication.

And thank you for the link to the couchbaselabs url. That’s exactly what I needed!
With the using Couchbase.Core and using Couchbase.Authentication I was able to get it to compile.
I knew there had to be a namespace I was missing.

I’ll let you know if this gets me logged in!