[Couchbase 5.0 Developer] LCB_AUTH_ERROR Issue using PHP

I have two systems: a MacOS running CB4.6 and an Ubuntu 16.04 running CB5.0 (April build).

A PHP script running on the Ubuntu system can access the CB database on the Mac, but whenever I try to access a bucket on the Ubuntu machine itself (or from the Mac), I get an LCB_AUTH_ERROR.

[cb,EROR] (negotiation L:131 I:0) <> (SASLREQ=0x5612a8fb5cb0) Error: 0x2, SASL AUTH failed
[cb,EROR] (cccp L:164 I:0) NOHOST:NOPORT Could not get configuration: LCB_AUTH_ERROR (0x02)
[cb,EROR] (htconfig L:142 I:0) <> Got non-success HTTP status code 401
[cb,EROR] (bootstrap L:129 I:0) Failed to bootstrap client=0x5612a8fb2470. Error=LCB_AUTH_ERROR (0x02), Message=No more bootstrap providers remain
[cb,EROR] (pcbc/pool L:92) Failed to bootstrap LCB connection: LCB_AUTH_ERROR: Authentication failed. You may have provided an invalid username/password combination. I=0x5612a8fb2470

Sounds as if there has been a password set on the bucket. With the new web console interface, I cannot see where one can add a password to the bucket. So, I changed to the old web console and tried to set the password on the bucket. It seems that it “doesn’t take” as each time I open that window, the password field remains blank. I’m not sure if the password is set but when I go to the log page, I do see that the bucket has been updated:

Updated bucket “beer-sample” (of type couchbase) properties:

Not seeing that the value for the password has been entered, if that change is noted by appearing in the log.

I’ve also noticed that there is a slight difference between the password entry in version 4.6 and the 5.0 version.

In 4.6, it says “Standard port (TCP port 11211. ASCII protocol or Binary auth-less)” while in 5.0 it says “Standard port (TCP port 11211. Needs SASL auth.)”

Not sure how to proceed. Anyone have any thoughts or am I SOL?

I just realized as I wrote this, can the old PHP libraries from 4.6 be used to connect 5.0 now that it appears that the error leads me to believe that maybe the API for it has changed too?

Could you show how you configure the \Couchbase\Cluster object?

In 5.0 there was new auth, so the best thing to do is to migrate to new authenticator, something like this:

$authenticator = new \Couchbase\PasswordAuthenticator();
// configure credentials of user, which has access to the buckets,
// used by application

$cluster = new \Couchbase\Cluster('couchbase://');

This authenticator first appeared in php_couchbase 2.3.2: https://www.couchbase.com/forums/t/ann-php-sdk-2-3-2-release

1 Like

I’ll have to try that. I’m using the older code snippets.

Solved one problem, but I keep getting 200 errors telling me that the user doesn’t have the rights, even though the user was given full admin rights and the password has been reset.

is it on the open bucket step? could you post the log with couchbase.log_level = TRACE?

I got frustrated, deleted all users, recreated the buckets (they’ve been empty since I put 5.0 on), then redid it all.

One thing that might be associated with it was when I updated couchbase to 2.3.2 using PECL. I got a segmentation fault but PECL list still indicated 2.3.2 is now installed. I didn’t take any chances and ripped that out too and reinstalled it but got the same error again. It appears to be working fine now.