Sync Gateway authentication error

We are having following configuration working perfectly
Server : 5.1
Sync Gateway : 2.0
CBL(Android) : 1.5

Now We are trying to switch to cbl 2.0 so I changed Sync URL to
instead of

and we started getting following error in the logs

05-21 12:40:49.844 13418-13554/com.diro E/LiteCore [Sync]: {Repl#1}==> N8litecore4repl10ReplicatorE /data/user/0/com.diro/files/ghost.cblite2/ ->
{Repl#1} Got LiteCore error: Unauthorized (6/401)
05-21 12:40:55.148 13418-13556/com.diro E/LiteCore [Sync]: {Repl#2}==> N8litecore4repl10ReplicatorE /data/user/0/com.diro/files/diro.cblite2/ ->
{Repl#2} Got LiteCore error: Unauthorized (6/401)

I am not able to figure out the error. Can some body help me out??

Are you using the basic authentication ? If yes then would like you to know that the authenticationfactory doesn’t work on 2.0. And you need to use specific authentication.

Can you share your syncgateway configuration also.

We are using basic account Authenticator as provided in cbl2.0 docs i.e.

// Add authentication.
replConfig.setAuthenticator(new BasicAuthenticator("john", "pass"));

Sync gateway config file is

I am getting following response

05-21 14:58:47.825 3508-3987/com.diro W/WS: WebSocketListener.onFailure() response -> Response{protocol=http/1.1, code=401, message=Unauthorized, url=} Expected HTTP 101 response but was '401 Unauthorized'
        at okhttp3.RealCall$AsyncCall.execute(
        at java.util.concurrent.ThreadPoolExecutor.runWorker(
        at java.util.concurrent.ThreadPoolExecutor$

05-21 14:58:42.913 3508-3986/com.diro W/LiteCore [WS]: {N8litecore9websocket12C4SocketImplE#1}==> N8litecore9websocket12C4SocketImplE
    {N8litecore9websocket12C4SocketImplE#1} WebSocket closed abnormally with status 401
05-21 14:58:42.913 3508-3966/com.diro E/LiteCore [Sync]: {Repl#1}==> N8litecore4repl10ReplicatorE /data/user/0/com.diro/files/diro.cblite2/ ->
    {Repl#1} Got LiteCore error: Unauthorized (6/401)

The user doesn’t appear to be configured in your Sync Gateway. Make sure your configure the list of valid users in the configuration file or use the user REST API to add the user.

Once users are added, you can dynamically give access to users via channels/access APIs.

An example configuration file for reference

Yes you are right,

I figured it out. The problem is now fixed