Skip to content

Commit 642953d

Browse files
authored
Merge branch 'main' into docs/update-changelog-233fc24c
2 parents 92b7763 + 9316327 commit 642953d

19 files changed

+356
-267
lines changed

advanced/subpath/vercel.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ following configuration to your `vercel.json` file.
2828
```
2929

3030
<Note>
31-
For more information, you can also refer to Vercel's offical guide on check
32-
out the [Project Configuration:
31+
For more information, you can also refer to Vercel's offical guide on
32+
rewrites: [Project Configuration:
3333
Rewrites](https://vercel.com/docs/projects/project-configuration#rewrites)
3434
</Note>

advanced/user-auth/choosing-an-auth-method.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: 'Choosing an Auth Method'
33
description: 'How to decide which auth method is right for your docs'
44
---
55

6-
Before your users can access personalized content, they must be authenticated. Mintlify supports two methods of authenticating users:
6+
Before your users can access personalized content, they must be authenticated. Mintlify supports three methods of authenticating users:
77

88
1. **Shared Session**: Utilize the same session token used by your dashboard to authenticate users.
99
2. **JWT**: Use your own login flow to send user info to your docs via a JWT in the URL.

advanced/user-auth/jwt.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ If you don’t have a dashboard, or if you want to keep your dashboard and docs
1515
Create a login flow that does the following:
1616
- Authenticate the user
1717
- Create a JWT containing the authenticated user's info in the [UserInfo](./sending-data) format
18-
- Sign the JWT with the secret, using the ES256 algorithm
18+
- Sign the JWT with the secret, using the EdDSA algorithm
1919
- Create a redirect URL back to your docs, including the JWT as the hash
2020
</Step>
2121
<Step title="Configure your User Auth settings">
@@ -46,7 +46,7 @@ import { Request, Response } from 'express';
4646

4747
const TWO_WEEKS_IN_MS = 1000 * 60 * 60 * 24 * 7 * 2;
4848

49-
const signingKey = await jose.importPKCS8(process.env.MINTLIFY_PRIVATE_KEY, 'ES256');
49+
const signingKey = await jose.importPKCS8(process.env.MINTLIFY_PRIVATE_KEY, 'EdDSA');
5050

5151
export async function handleRequest(req: Request, res: Response) {
5252
const userInfo = {
@@ -59,7 +59,7 @@ export async function handleRequest(req: Request, res: Response) {
5959
};
6060

6161
const jwt = await new jose.SignJWT(userInfo)
62-
.setProtectedHeader({ alg: 'ES256' })
62+
.setProtectedHeader({ alg: 'EdDSA' })
6363
.setExpirationTime('10 s')
6464
.sign(signingKey);
6565

advanced/user-auth/overview.mdx

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,22 @@ title: 'Introduction'
33
description: 'Give your users a personalized docs experience'
44
---
55

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.
77

88
Example use cases:
99

1010
1. **Customize MDX content** with a user's information, such as their name, plan, or title.
11+
1112
2. **Prefill API keys** in the API Playground for streamlined use.
13+
1214
3. **Selectively show pages** in the navigation based on a user's groups.
1315

1416
## What *isn't* User Auth
1517

1618
At this time, User Auth is not meant for the following use cases:
1719

1820
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+
1922
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.
2023

2124
<Note>If you are interested in private docs content, [contact our team](mailto:[email protected]) to explore solutions.</Note>
@@ -35,11 +38,11 @@ Hello, {userContext.name ?? 'reader'}!
3538
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:
3639
3740
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>.</>
4346
}
4447
4548
```jsx
@@ -59,6 +62,7 @@ User Auth is an enterprise feature. {
5962
### Prefilling API Keys
6063
6164
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+
6266
### Showing/Hiding Pages
6367
6468
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']
7579
7680
Here's a table that displays whether a page is shown for different combinations of `groups` in UserInfo and page metadata:
7781
78-
| | `groups` not in UserInfo | `groups: []` in UserInfo | `groups: ['admin']` in UserInfo |
79-
|:-----------------------------------|:------------------------:|:-------------------------:|:--------------------------------:|
80-
| `groups` not in metadata | | | |
81-
| `groups: []` in metadata | | | |
82-
| `groups: ['admin']` in metadata | | | |
82+
| | `groups` not in UserInfo | `groups: []` in UserInfo | `groups: ['admin']` in UserInfo |
83+
| :------------------------------ | :----------------------: | :----------------------: | :-----------------------------: |
84+
| `groups` not in metadata | | | |
85+
| `groups: []` in metadata | | | |
86+
| `groups: ['admin']` in metadata | | | |
8387
84-
<Note>Note that an empty array in the page metadata is interpreted as "No groups should see this page."</Note>
88+
<Note>Note that an empty array in the page metadata is interpreted as "No groups should see this page."</Note>

api-playground/openapi/setup.mdx

Lines changed: 52 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,9 @@ document in either JSON or YAML format that follows the
1010
[OpenAPI specification](https://swagger.io/specification/). Your document must
1111
follow OpenAPI specification 3.0+.
1212

13-
## Autogenerating the API playground
13+
## Auto-populate API pages
1414

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.
2316

2417
**Example with Anchors:**
2518

@@ -54,25 +47,29 @@ repo (json or yaml) or hosted at a link.
5447

5548
![](/images/autogeneration-with-tabs.png)
5649

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.
5855

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
61-
over the navigation. Here is
62-
[the code](https://github.com/elevenlabs/elevenlabs-docs/blob/e5e267c97b8d1e4c21db1dcdb8b005eb1dfed7da/api-reference/speech-to-speech.mdx?plain=1#L2)
63-
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).&#x20;
6463

6564
![](/images/elevenlabs-mdx-autogeneration-example.png)
6665

67-
If you want to autogenerate MDX files for every endpoint in your OpenAPI
68-
document you can use our scraper.
66+
### Autogenerate files
6967

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.
7169

7270
Our Mintlify [scraper](https://www.npmjs.com/package/@mintlify/scraping)
7371
autogenerates MDX files for your OpenAPI endpoints. Use the relative path to the
74-
OpenAPI document in your codebase. If you're using a publicly-hosted OpenAPI
75-
document, you can supply the URL in place of a path.
72+
OpenAPI document in your codebase.
7673

7774
```bash
7875
npx @mintlify/scraping@latest openapi-file <path-to-openapi-file>
@@ -85,8 +82,7 @@ not specified, the files will populate in the working directory.
8582
npx @mintlify/scraping@latest openapi-file <path-to-openapi-file> -o api-reference
8683
```
8784

88-
Learn more about our scraping package
89-
[here](https://www.npmjs.com/package/@mintlify/scraping).
85+
Learn more about our scraping package [here](https://www.npmjs.com/package/@mintlify/scraping).
9086

9187
The scraper will output an array of
9288
[Navigation entries](/settings/global#structure) containing your OpenAPI MDX
@@ -97,38 +93,39 @@ reorder and add the files to your navigation manually.
9793
If your OpenAPI document is invalid, the files will not autogenerate.
9894
</Note>
9995

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.
10199

102100
<Snippet file="api-playground/openapi.mdx" />
103101

104102
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.
106104

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
109106
only one OpenAPI file - it will automatically detect your OpenAPI file.
110107

111108
<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+
```
127122
</CodeGroup>
123+
128124
<br />
125+
129126
<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,
132129
the page will be empty.
133130
</Note>
134131

@@ -138,17 +135,15 @@ Mintlify also allows you to create individual pages for any OpenAPI schema
138135
defined in an OpenAPI document's `components.schemas` field:
139136

140137
<CodeGroup>
141-
142-
```md Example
143-
---
144-
openapi-schema: OrderItem
145-
---
146-
```
147-
148-
```md Format
149-
---
150-
openapi-schema: "schema-key"
151-
---
152-
```
153-
154-
</CodeGroup>
138+
```md Example
139+
---
140+
openapi-schema: OrderItem
141+
---
142+
```
143+
144+
```md Format
145+
---
146+
openapi-schema: "schema-key"
147+
---
148+
```
149+
</CodeGroup>

0 commit comments

Comments
 (0)