You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: advanced/user-auth/overview.mdx
+16-12Lines changed: 16 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,19 +3,22 @@ title: 'Introduction'
3
3
description: 'Give your users a personalized docs experience'
4
4
---
5
5
6
-
User Auth allows you to identify and authenticate your users so that you can personalize docs content for them. your users.
6
+
User Auth allows you to identify and authenticate your users so that you can personalize docs content for them. Your users.
7
7
8
8
Example use cases:
9
9
10
10
1.**Customize MDX content** with a user's information, such as their name, plan, or title.
11
+
11
12
2.**Prefill API keys** in the API Playground for streamlined use.
13
+
12
14
3.**Selectively show pages** in the navigation based on a user's groups.
13
15
14
16
## What *isn't* User Auth
15
17
16
18
At this time, User Auth is not meant for the following use cases:
17
19
18
20
1.**Private docs content.** While you can hide pages from unauthenticated users, those pages are still accessible by anyone who can guess the URL. If your documentation contains sensitive information, User Auth is not enough to hide it.
21
+
19
22
2.**A Mintlify-backed user database.** Mintlify does not store *any* information about your users. Rather, it relies on your existing infrastructure to serve as the source-of-truth for user data.
20
23
21
24
<Note>If you are interested in private docs content, [contact our team](mailto:[email protected]) to explore solutions.</Note>
This feature becomes even more powerful when paired with custom data about the user. Here's a real world example that allows us to give specific instructions on how to access the User Auth feature based on the customer's existing plan:
36
39
37
40
User Auth is an enterprise feature. {
38
-
userContext.org === undefined
39
-
? <>To access this feature, first create an account at the <a href="https://dashboard.mintlify.com/login">Mintlify dashboard</a>.</>
40
-
: userContext.org.plan !== 'enterprise'
41
-
? <>You are currently on the ${userContext.org.plan??'free'} plan. To speak to our team about upgrading, <a href="mailto:[email protected]">contact our sales team</a>.</>
42
-
:<>To request this feature for your enterprise org, <a href="mailto:[email protected]">contact our team</a>.</>
41
+
userContext.org === undefined
42
+
? <>To access this feature, first create an account at the <a href="https://dashboard.mintlify.com/login">Mintlify dashboard</a>.</>
43
+
: userContext.org.plan !== 'enterprise'
44
+
? <>You are currently on the ${userContext.org.plan??'free'} plan. To speak to our team about upgrading, <a href="mailto:[email protected]">contact our sales team</a>.</>
45
+
:<>To request this feature for your enterprise org, <a href="mailto:[email protected]">contact our team</a>.</>
43
46
}
44
47
45
48
```jsx
@@ -59,6 +62,7 @@ User Auth is an enterprise feature. {
59
62
### Prefilling API Keys
60
63
61
64
If you return API Playground inputs in the user info, they will automatically be prefilled in the API Playground. Make sure the name of the field in the user info is an exact match of the name in the API Playground.
65
+
62
66
### Showing/Hiding Pages
63
67
64
68
By default, every page is visible to every user. If you want to restrict which pages are visible to your users, you can add a `groups` field in your page metadata.
@@ -75,10 +79,10 @@ groups: ['admin']
75
79
76
80
Here's a table that displays whether a page is shown for different combinations of `groups` in UserInfo and page metadata:
77
81
78
-
| | `groups` not in UserInfo | `groups: []` in UserInfo | `groups: ['admin']` in UserInfo |
Copy file name to clipboardExpand all lines: api-playground/openapi/setup.mdx
+52-57Lines changed: 52 additions & 57 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,16 +10,9 @@ document in either JSON or YAML format that follows the
10
10
[OpenAPI specification](https://swagger.io/specification/). Your document must
11
11
follow OpenAPI specification 3.0+.
12
12
13
-
## Autogenerating the API playground
13
+
## Auto-populate API pages
14
14
15
-
You can either [autogenerate the API playground](/settings/navigation#tabs) or
16
-
create MDX files for the individual OpenAPI endpoints.
17
-
18
-
### Auto-populate API pages
19
-
20
-
You can add an `openapi` field to an object in the `tabs` or `anchors` array in
21
-
the `mint.json`. This can either be with OpenAPI documents that are in the docs
22
-
repo (json or yaml) or hosted at a link.
15
+
The fastest way to get started with OpenAPI is to add an `openapi` field to a tab or anchor in the `mint.json`. This field can contain either the path to an OpenAPI document in your docs repo, or the URL of a hosted OpenAPI document. Mintlify will automatically generate a page for each OpenAPI operation and place them in the tab/anchor.
23
16
24
17
**Example with Anchors:**
25
18
@@ -54,25 +47,29 @@ repo (json or yaml) or hosted at a link.
54
47
55
48

56
49
57
-
### Create MDX files for OpenAPI endpoints
50
+
When using this option, the metadata for the generated pages will have the following default values:
51
+
52
+
*`title`: The `summary` field from the OpenAPI operation, if present. Otherwise a title generated from the HTTP method and endpoint.
53
+
54
+
*`description`: The `description` field from the OpenAPI operation, if present.
58
55
59
-
You can also create MDX files associated with each OpenAPI endpoint if you would
60
-
like to add additional context to specific pages or have more granular control
from [Elevenlabs](https://elevenlabs.io/docs/api-reference/speech-to-speech).
56
+
*`version`: The `version` value from the anchor or tab, if present.
57
+
58
+
There are some scenarios in which the default behavior isn't sufficient. If you need more customizability, you can create an MDX page for your OpenAPI operation, and modify it just like any other MDX page.
59
+
60
+
## Create MDX files for API pages
61
+
62
+
If you want to customize the page metadata, add additional content, omit certain OpenAPI operations, or reorder OpenAPI pages in your navigation, you'll need an MDX page for each operation. Here is [an example MDX OpenAPI page](https://github.com/elevenlabs/elevenlabs-docs/blob/e5e267c97b8d1e4c21db1dcdb8b005eb1dfed7da/api-reference/speech-to-speech.mdx?plain=1#L2) from [Elevenlabs](https://elevenlabs.io/docs/api-reference/speech-to-speech). 
If you want to autogenerate MDX files for every endpoint in your OpenAPI
68
-
document you can use our scraper.
66
+
### Autogenerate files
69
67
70
-
#### Autogenerate files
68
+
For large OpenAPI documents, creating one MDX page for each OpenAPI operation can be a lot of work. To make it easier, we created a local OpenAPI page scraper.
Learn more about our scraping package [here](https://www.npmjs.com/package/@mintlify/scraping).
90
86
91
87
The scraper will output an array of
92
88
[Navigation entries](/settings/global#structure) containing your OpenAPI MDX
@@ -97,38 +93,39 @@ reorder and add the files to your navigation manually.
97
93
If your OpenAPI document is invalid, the files will not autogenerate.
98
94
</Note>
99
95
100
-
#### Manually specify files
96
+
### Manually specify files
97
+
98
+
You can always create an MDX page manually, and reference the OpenAPI operation in the page's metadata using the `openapi` field.
101
99
102
100
<Snippetfile="api-playground/openapi.mdx" />
103
101
104
102
By using the OpenAPI reference, the name, description, parameters, responses,
105
-
and the API playground will be automatically generated using the specifications.
103
+
and the API playground will be automatically generated from the OpenAPI document.
106
104
107
-
If you have multiple OpenAPI files, include the path to the OpenAPI file to map
108
-
the MDX file to the appropriate OpenAPI file. This is not required if you have
105
+
If you have multiple OpenAPI files, include the path to the OpenAPI file to ensure Mintlify finds the correct OpenAPI document. This is not required if you have
109
106
only one OpenAPI file - it will automatically detect your OpenAPI file.
110
107
111
108
<CodeGroup>
112
-
113
-
```md Example
114
-
---
115
-
title: "Get users"
116
-
openapi: "/path/to/openapi-1.json GET /users"
117
-
---
118
-
```
119
-
120
-
```md Format
121
-
---
122
-
title: "title of the page"
123
-
openapi: openapi-file-path method path
124
-
---
125
-
```
126
-
109
+
```md Example
110
+
---
111
+
title: "Get users"
112
+
openapi: "/path/to/openapi-1.json GET /users"
113
+
---
114
+
```
115
+
116
+
```md Format
117
+
---
118
+
title: "title of the page"
119
+
openapi: openapi-file-path method path
120
+
---
121
+
```
127
122
</CodeGroup>
123
+
128
124
<br />
125
+
129
126
<Note>
130
-
The method endpoint must match the endpoint specified in the OpenAPI
131
-
specifications exactly. If the endpoint doesn't exist in the OpenAPI file,
127
+
The method and path must match the method and path specified in the OpenAPI
128
+
document exactly. If the endpoint doesn't exist in the OpenAPI file,
132
129
the page will be empty.
133
130
</Note>
134
131
@@ -138,17 +135,15 @@ Mintlify also allows you to create individual pages for any OpenAPI schema
138
135
defined in an OpenAPI document's `components.schemas` field:
0 commit comments