Basic authentification for sync gateway 3.1 configuration

hello,
in my new architecture, i have a sync gateway 3.1.2.
I have configure 2 databases.
I use the basic authentification from my couchBase Lite Client in 2.8.6 version.
But I have 401 error (unauthorized).

With REST API, I created a user ‘SyncGateway’ for my databases, but I always have the same error.

here, one of my databases config.

{
    "bucket": "referential",
    "name": "nestor-referential",
    "sync": " function (doc, oldDoc) {
        if (doc.type == \"SystemUser\" || doc.type == \"SystemUserSettings\" || (oldDoc != null && (oldDoc.type == \"SystemUser\" || oldDoc.type == \"SystemUserSettings\")))
            channel(\"system-user\");
        else if (doc.type == \"Log\" || (oldDoc != null && oldDoc.type == \"Log\"))
            channel(\"logs\");
        else if(doc.type != \"Database\" && doc.type != \"Synchronisation\" && (oldDoc == null || (oldDoc.type != \"Database\" && oldDoc.type != \"Synchronisation\")))
            channel(\"referential\");
         throw ({ forbidden: \"Canceled document\" });                 
    } ",
    "revs_limit": 20,
    "allow_conflicts": false,
    "num_index_replicas": 0
}

and the created user

{
    "name": "syncGateway",
    "admin_channels": [  "*"  ],
    "email": "",
    "disabled": false,
    "all_channels": [ "!",    "*"   ]
}

the sync gateways config

{
  "bootstrap": {
    "server": "couchbase://localhost",
	"use_tls_server": false,
    "username": "SYNC-GATEWAY",
    "password": "SYNC-GATEWAY"
  },
  "api": {
    "public_interface": "0.0.0.0:4984",
    "admin_interface": "10.111.143.130:4985",
    "https": {}
  },
  "logging": {
    "log_file_path": "E:\\logs",
    "console": {
      "rotation": {}
    },
    "error": {
      "enabled": true,
      "rotation": {
        "max_size": 20,
        "max_age": 180,
        "localtime": true
      }
    },
    "warn": {
      "enabled": true,
      "rotation": {
        "max_size": 20,
        "max_age": 90,
        "localtime": true
      }
    },
    "info": {
      "enabled": true,
      "rotation": {
        "max_size": 20,
        "max_age": 3,
        "localtime": true
      }
    },
    "debug": {
      "enabled": false,
      "rotation": {
        "max_size": 20,
        "max_age": 1,
        "localtime": true
      }
    },
    "trace": {
      "rotation": {}
    },
    "stats": {
      "rotation": {}
    }
  },
  "auth": {},
  "replicator": {}
}

Someone can help me to find what is wrong ?

Just to confirm, you’re using the Public API from the app? (Port 4984) and are referring to the correct database name? (nestor-referential)

yes absolutely

I created the databases and the user from admin REST API (port 4985).

My CouchBase Lite client uses the public port (4984).