Closed tleyden closed 9 years ago
cc'ing @nimishzynga
Looks like that maybeAddAuth() hasn't changed for awhile. So, it might be some higher-level code that changed related to auth.
https://github.com/couchbase/go-couchbase/commit/89d88b58c124de71421a8ed027c022b932a78bca
Hi Traun, Just tried it with cbft, and it worked. How are you connecting to the default bucket? By passing in "default" or by passing in empty string ("")?
Closing this issue as it looks like it's probably not a go-couchbase issue.
I'm connecting to a default bucket via CBGT, which uses the go-couchbase cbdatasource connection library.
The problem appears to be in this method:
Even though
user
andpass
are both empty, it tries to add the Basic Authorization header, which ends up failing to connect with 401 errors.A workaround that appears to work is:
This works around the issue by only adding the Basic Auth header if the user is non-empty.
I'm not sure why it has a non-nil AuthHandler if the username and password are both empty. That might be a bug somewhere up in the callstack of the code that calls this method. Even so, checking for a non-empty user seems like good defensive coding, since it doesn't seem like a valid use case to set a Basic Auth header with an empty user.