Question on users + buckets + config file

Referencing the sgw config format:

We’re going to dynamically generate users at runtime using the admin API. We plan on having two separate buckets, but it appears to me that I then need to duplicate a user per each bucket…at least the way the configuration file is structured. I don’t want to use the global bucket password to authenticate for mobile clients – we need to identify them as individual users, but I also don’t want to have to create two identical users just to allow them the opportunity of syncing from the two buckets?

In this example config:

  "log": ["*"],
  "databases": {
    "test-getting-started": {
      "server": "http://localhost:8091",
      "bucket": "test-getting-started",
      "username": "sync_gateway", 
      "password": "password", 
      "enable_shared_bucket_access": true, 
      "import_docs": "continuous",
      "users": {
        "GUEST": { "disabled": false, "admin_channels": ["*"] }
      "sync": `function (doc, oldDoc) {
        if (doc.sdk) {

Is there not a way to map more than one bucket to that “database” called “test-getting-started”?

Nope, bucket and databases are a 1:1 mapping.

You could use an external authentication provider via OpenID Connect in order to share a single set of users between buckets/databases.

Failing that, you might be able to tweak your data model, and share the same bucket by specifying a field on documents that you wish to differentiate by?