@borrrden yes, I have stumbled upon that detail while digging.
I’m still struggling to understand how databases and users work. For instance, I have a database configured with a user name and password. Through the server dashboard I have created a bucket. But if I use the sync-gateway admin api to create a database, I can’t see it through the server dashboard. Neither I can see created users.
Also, the API explorer for the databases call doesn’t seem to be working correctly. It doesn’t seem to fill the curl properly so I need to write the escaped JSON by hand which takes me much more time to explore the API.
C you please tell me exactly which headers (or point me a document where that is specified) should I use in the authentication process of the websocket open?
I’m using the QCBLWebSocket class made available by this project as a wrapper to couchbase-lite-core in Qt. I’m using Qt myself too.
While I’m passing the auth info to the replicator initialisation the fact is that it doesn’t seem to be used during websocket open.
I have a question. What’s the name of the auth headers that sync gateway expects to receive in the other side?
void QCBLWebSocket::startSocket()
{
QUrl url(QString("%0://%1:%2%3").arg(scheme,host).arg(port).arg(path));
QNetworkRequest r(url);
for (Dict::iterator header(options.get(kC4ReplicatorOptionAuthentication).asDict()); header; ++header)
{
QSlice key(header.key().asString());
QSlice value(header.value().asString());
r.setRawHeader(QSlice::qslToQByteArray(key),QSlice::qslToQByteArray(value));
}
QSlice cookies(options.get(kC4ReplicatorOptionCookies).asString());
if (!cookies.isEmpty())
r.setRawHeader("Cookie",QSlice::qslToQByteArray(cookies));
QSlice protocols(options.get(kC4SocketOptionWSProtocols).asString());
if (!protocols.isEmpty())
r.setRawHeader("Sec-WebSocket-Protocol",QSlice::qslToQByteArray(protocols));
open(r);
}
This are the keys there are being filled upon replicator construction. Inside the socket they must be put into the Raw Header.
#define kC4ReplicatorOptionAuthentication "auth"
#define kC4AuthTypeBasic “Basic”
#define kC4ReplicatorAuthType "type"
#define kC4ReplicatorAuthUserName "username"
#define kC4ReplicatorAuthPassword "password"
How should I place this info into the Raw Headers? Because I have already tried the way above and the result is exactly the same, sync-gateway is logging that the request requires authentication.
Thanks in advance!
Best regards,
Nuno