mirror of
https://github.com/mintlify/docs.git
synced 2026-09-14 13:35:46 +08:00
40d2e2cd2d
* Add proper language support for syntax highlighting to all code blocks * Camel case inline code
94 lines
1.3 KiB
Plaintext
94 lines
1.3 KiB
Plaintext
---
|
|
title: "Authentication"
|
|
description: "You can set authentication parameters to let users use their real API keys."
|
|
---
|
|
|
|
## 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
|
|
|
|
<CodeGroup>
|
|
|
|
```json docs.json
|
|
"api": {
|
|
"mdx": {
|
|
"auth": {
|
|
"method": "bearer"
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
```mdx Page Metadata
|
|
---
|
|
title: "Your page title"
|
|
authMethod: "bearer"
|
|
---
|
|
```
|
|
|
|
</CodeGroup>
|
|
|
|
### Basic authentication
|
|
|
|
<CodeGroup>
|
|
|
|
```json docs.json
|
|
"api": {
|
|
"mdx": {
|
|
"auth": {
|
|
"method": "basic"
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
```mdx Page Metadata
|
|
---
|
|
title: "Your page title"
|
|
authMethod: "basic"
|
|
---
|
|
```
|
|
|
|
</CodeGroup>
|
|
|
|
### API key
|
|
|
|
<CodeGroup>
|
|
|
|
```json docs.json
|
|
"api": {
|
|
"mdx": {
|
|
"auth": {
|
|
"method": "key",
|
|
"name": "x-api-key"
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
```mdx Page Metadata
|
|
---
|
|
title: "Your page title"
|
|
authMethod: "key"
|
|
---
|
|
```
|
|
|
|
</CodeGroup>
|
|
|
|
### None
|
|
|
|
The "none" authentication method is useful to disable authentication on a specific endpoint after setting a default in docs.json.
|
|
|
|
<CodeGroup>
|
|
```mdx Page Metadata
|
|
---
|
|
title: "Your page title"
|
|
authMethod: "none"
|
|
---
|
|
```
|
|
</CodeGroup>
|