Skip to content

Commit dcff49e

Browse files
committed
undo reorging MDX content
1 parent de02346 commit dcff49e

File tree

3 files changed

+100
-13
lines changed

3 files changed

+100
-13
lines changed

api-playground/customization/authentication.mdx renamed to api-playground/mdx/authentication.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ title: "Authentication"
33
description: "You can set authentication parameters to let users use their real API keys."
44
---
55

6-
## Enabling Authentication
6+
## Enabling authentication
77

8-
You can add an authentication method to your docs.json to enable it on every page or you can set it on a per-page basis.
8+
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.
99

10-
The page's authentication method will override docs.json if both are set.
10+
A page's authentication method will override a global method if both are set.
1111

1212
### Bearer Token
1313

Lines changed: 89 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
title: 'MDX Setup'
33
description: 'Generate docs pages for your API endpoints using `MDX`'
4-
icon: 'markdown'
54
---
65

76
You can manually define API endpoints in individual `MDX` files rather than using an OpenAPI specification. This method provides flexibility for custom content, but we recommend generating API documentation from an OpenAPI specification file for most API documentation projects as it's more maintainable and feature-rich. However, MDX can be useful for documenting small APIs, prototyping, or when you want to feature API endpoints alongside other content.
@@ -75,3 +74,92 @@ To generate pages for API endpoints using `MDX`, configure your API settings in
7574
Add your endpoint pages to the sidebar by adding the paths to the `navigation` field in your `docs.json`. Learn more about structuring your docs in [Navigation](/navigation).
7675
</Step>
7776
</Steps>
77+
78+
## Enabling authentication
79+
80+
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.
81+
82+
A page's authentication method will override a global method if both are set.
83+
84+
### Bearer Token
85+
86+
<CodeGroup>
87+
88+
```json docs.json
89+
"api": {
90+
"mdx": {
91+
"auth": {
92+
"method": "bearer"
93+
}
94+
}
95+
}
96+
```
97+
98+
```md Page Metadata
99+
---
100+
title: "Your page title"
101+
authMethod: "bearer"
102+
---
103+
```
104+
105+
</CodeGroup>
106+
107+
### Basic Authentication
108+
109+
<CodeGroup>
110+
111+
```json docs.json
112+
"api": {
113+
"mdx": {
114+
"auth": {
115+
"method": "basic"
116+
}
117+
}
118+
}
119+
```
120+
121+
```md Page Metadata
122+
---
123+
title: "Your page title"
124+
authMethod: "basic"
125+
---
126+
```
127+
128+
</CodeGroup>
129+
130+
### API Key
131+
132+
<CodeGroup>
133+
134+
```json docs.json
135+
"api": {
136+
"mdx": {
137+
"auth": {
138+
"method": "key",
139+
"name": "x-api-key"
140+
}
141+
}
142+
}
143+
```
144+
145+
```md Page Metadata
146+
---
147+
title: "Your page title"
148+
authMethod: "key"
149+
---
150+
```
151+
152+
</CodeGroup>
153+
154+
### None
155+
156+
The "none" authentication method is useful to disable authentication on a specific endpoint after setting a default in docs.json.
157+
158+
<CodeGroup>
159+
```md Page Metadata
160+
---
161+
title: "Your page title"
162+
authMethod: "none"
163+
---
164+
```
165+
</CodeGroup>

docs.json

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,14 @@
8585
"api-playground/asyncapi/playground"
8686
]
8787
},
88-
"api-playground/mdx-setup",
88+
{
89+
"group": "MDX",
90+
"icon": "markdown",
91+
"pages": [
92+
"api-playground/mdx/configuration",
93+
"api-playground/mdx/authentication"
94+
]
95+
},
8996
"api-playground/troubleshooting"
9097
]
9198
},
@@ -374,14 +381,6 @@
374381
"source": "/api-playground/openapi/advanced-features",
375382
"destination": "/api-playground/customization/advanced-features"
376383
},
377-
{
378-
"source": "/api-playground/mdx/authentication",
379-
"destination": "/api-playground/customization/authentication"
380-
},
381-
{
382-
"source": "/api-playground/mdx/configuration",
383-
"destination": "/api-playground/mdx-setup"
384-
},
385384
{
386385
"source": "/api-playground/openapi/openapi-setup",
387386
"destination": "/api-playground/openapi-setup"

0 commit comments

Comments
 (0)