Enabling authentication

You can add an authentication method to your docs.json to enable it globally on every page or you can set it on a per-page basis.

A page’s authentication method will override a global method if both are set.

Bearer token

"api": {
    "mdx": {
      "auth": {
        "method": "bearer"
      }
    }
}

Basic authentication

"api": {
    "mdx": {
      "auth": {
        "method": "basic"
      }
    }
}

API key

"api": {
    "mdx": {
      "auth": {
        "method": "key",
        "name": "x-api-key"
      }
    }
}

None

The “none” authentication method is useful to disable authentication on a specific endpoint after setting a default in docs.json.

---
title: "Your page title"
authMethod: "none"
---