Skip to content

Commit e3238fe

Browse files
committed
Merge branch 'main' into ricky/advanced-footer
2 parents 0c5958d + 120e2e8 commit e3238fe

File tree

25 files changed

+471
-57
lines changed

25 files changed

+471
-57
lines changed

.DS_Store

-6 KB
Binary file not shown.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.DS_Store
2+
node_modules
3+
package-lock.json

advanced/custom/js.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ description: 'Add JavaScript functionality globally'
99

1010
Custom JS allows you to add custom executable code globally. It is the equivalent of adding a `<script>` tag with JS code into every page.
1111

12-
## Adding script.js
12+
## Adding Custom JavaScript
1313

14-
For example, you can add the following `script.js` file to enable [Google Analytics](https://marketingplatform.google.com/about/analytics) across the entire documentation.
14+
Any `.js` file inside the content directory of your docs will be included in every documentation page. For example, you can add the following `ga.js` file to enable [Google Analytics](https://marketingplatform.google.com/about/analytics) across the entire documentation.
1515

1616
```js
1717
window.dataLayer = window.dataLayer || [];

advanced/rest-api/overview.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ functionality to the API overtime. Let us know what else you want to see in
1414
## Authentication
1515

1616
You can generate an API key through
17-
[the dashboard](https://dashboard.mintlify.com/settings/api). The API key is
17+
[the dashboard](https://dashboard.mintlify.com/settings/integrations). The API key is
1818
associated with the entire org and can be used across multiple deployments.
1919

2020
<Frame>

advanced/user-auth/jwt.mdx

Lines changed: 50 additions & 4 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
18+
- Sign the JWT with the secret, using the ES256 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">
@@ -25,8 +25,54 @@ If you don’t have a dashboard, or if you want to keep your dashboard and docs
2525

2626
## Example
2727

28-
I want to set up authentication for my docs hosted at `docs.foo.com`. I want my docs to be completely separate from my dashboard (or I don’t have a dashboard at all).
28+
I want to set up authentication for my docs hosted at `docs.foo.com`. I want my docs
29+
to be completely separate from my dashboard (or I don’t have a dashboard at all).
2930

30-
To set up authentication with Mintlify, I go to my Mintlify dashboard and generate a JWT secret. I create a web URL `https://foo.com/docs-login` that initiates a login flow for my users. At the end of this login flow, once I have verified the identity of the user, I create a JWT containing the user’s custom data according to Mintlify’s specification. I sign this JWT with my Mintlify secret, create a redirect URL of the form `https://docs.foo.com#{SIGNED_JWT}`, and redirect the user.
31+
To set up authentication with Mintlify, I go to my Mintlify dashboard and generate a
32+
JWT secret. I create a web URL `https://foo.com/docs-login` that initiates a login flow
33+
for my users. At the end of this login flow, once I have verified the identity of the user,
34+
I create a JWT containing the user’s custom data according to Mintlify’s specification.
35+
I use a JWT library to sign this JWT with my Mintlify secret, create a redirect URL of the
36+
form `https://docs.foo.com#{SIGNED_JWT}`, and redirect the user.
3137

32-
I then go to the Mintlify dashboard settings and enter `https://foo.com/docs-login` for the Login URL field.
38+
I then go to the Mintlify dashboard settings and enter `https://foo.com/docs-login` for the
39+
Login URL field.
40+
41+
Here's what the code might look like:
42+
43+
```ts
44+
import * as jose from 'jose';
45+
import { Request, Response } from 'express';
46+
47+
const TWO_WEEKS_IN_MS = 1000 * 60 * 60 * 24 * 7 * 2;
48+
49+
const signingKey = await jose.importPKCS8(process.env.MINTLIFY_PRIVATE_KEY, 'ES256');
50+
51+
export async function handleRequest(req: Request, res: Response) {
52+
const userInfo = {
53+
expiresAt: Math.floor((Date.now() + TWO_WEEKS_IN_MS) / 1000),
54+
groups: res.locals.user.groups,
55+
content: {
56+
firstName: res.locals.user.firstName,
57+
lastName: res.locals.user.lastName,
58+
},
59+
};
60+
61+
const jwt = await new jose.SignJWT(userInfo)
62+
.setProtectedHeader({ alg: 'ES256' })
63+
.setExpirationTime('10 s')
64+
.sign(signingKey);
65+
66+
return res.redirect(`https://docs.foo.com#${jwt}`);
67+
}
68+
69+
```
70+
71+
## Preserving Anchors
72+
73+
Post-login, if you'd like to redirect to a specific anchor on the page, you can use the following format to create the redirect URL: `https://docs.foo.com/page#jwt={SIGNED_JWT}&anchor={ANCHOR}`.
74+
75+
Example:
76+
77+
- Original: `https://docs.foo.com/quickstart#step-one`
78+
- Redirect: `https://docs.foo.com/quickstart#jwt={SIGNED_JWT}&anchor=step-one`

api-playground/mdx/authentication.mdx

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ You can add an authentication method to your mint.json to enable it on every pag
99

1010
The page's authentication method will override mint.json if both are set.
1111

12+
### Bearer Token
13+
1214
<CodeGroup>
1315

1416
```json mint.json
@@ -19,7 +21,7 @@ The page's authentication method will override mint.json if both are set.
1921
}
2022
```
2123

22-
```md page metadata
24+
```md Page Metadata
2325
---
2426
title: "Your page title"
2527
authMethod: "bearer"
@@ -28,36 +30,58 @@ authMethod: "bearer"
2830

2931
</CodeGroup>
3032

31-
## Supported Authentication Methods
32-
33-
- bearer
34-
- basic
35-
- none
36-
37-
The "none" authentication method is useful to disable authentication on a specific endpoint after setting a default in mint.json.
38-
39-
## Authentication Name
33+
### Basic Authentication
4034

41-
By default, basic authentication asks for username and password. However, basic authentication can use a different name for username and password. For example, you could have called it `user-id:user-key`.
42-
43-
You can set the name property in mint.json to override the default functionality. Use colons to separate each property you want to request.
35+
<CodeGroup>
4436

45-
```json Custom username and password
37+
```json mint.json
4638
"api": {
4739
"auth": {
48-
"method": "basic",
49-
"name": "user-id:user-key"
40+
"method": "basic"
5041
}
5142
}
5243
```
5344

54-
You can also request a single API key by excluding the colon.
45+
```md Page Metadata
46+
---
47+
title: "Your page title"
48+
authMethod: "basic"
49+
---
50+
```
51+
52+
</CodeGroup>
5553

56-
```json Custom username and password
54+
### API Key
55+
56+
<CodeGroup>
57+
58+
```json mint.json
5759
"api": {
5860
"auth": {
5961
"method": "key",
60-
"name": "my-api-key"
62+
"name": "x-api-key"
6163
}
6264
}
6365
```
66+
67+
```md Page Metadata
68+
---
69+
title: "Your page title"
70+
authMethod: "key"
71+
---
72+
```
73+
74+
</CodeGroup>
75+
76+
### None
77+
78+
The "none" authentication method is useful to disable authentication on a specific endpoint after setting a default in mint.json.
79+
80+
<CodeGroup>
81+
```md Page Metadata
82+
---
83+
title: "Your page title"
84+
authMethod: "none"
85+
---
86+
```
87+
</CodeGroup>

api-playground/troubleshooting.mdx

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
title: "Troubleshooting"
3+
description: "Common issues with API References"
4+
icon: "triangle-exclamation"
5+
---
6+
7+
API pages are complicated. As a result, there are a lot of things that can go wrong.
8+
Here's a list of common issues we've seen customers run into:
9+
10+
<AccordionGroup>
11+
<Accordion title="All of my OpenAPI pages are completely blank">
12+
In this scenario, it's likely that either Mintlify cannot find your OpenAPI document,
13+
or your OpenAPI document is invalid.
14+
15+
Running `mintlify dev` locally should reveal some of these issues.
16+
17+
To verify your OpenAPI document will pass validation:
18+
19+
1. Visit [this validator](https://apitools.dev/swagger-parser/online/)
20+
2. Switch to the "Validate text" tab
21+
3. Paste in your OpenAPI document
22+
4. Click "Validate it!"
23+
24+
If the text box that appears below has a green border, your document has passed validation.
25+
This is the exact validation package Mintlify uses to validate OpenAPI documents, so if your document
26+
passes validation here, there's a great chance the problem is elsewhere.
27+
28+
Additionally, Mintlify does not support OpenAPI 2.0. If your document uses this version of the specification,
29+
you could encounter this issue. You can convert your document at [editor.swagger.io](https://editor.swagger.io/) (under Edit > Convert to OpenAPI 3):
30+
31+
<Frame>
32+
<img src="/images/convert-oas-3.png" />
33+
</Frame>
34+
35+
</Accordion>
36+
37+
<Accordion title="One of my OpenAPI pages is completely blank">
38+
This is usually caused by a misspelled `openapi` field in the page metadata. Make sure
39+
the HTTP method and path match the HTTP method and path in the OpenAPI document exactly.
40+
41+
Here's an example of how things might go wrong:
42+
43+
```md get-user.mdx
44+
---
45+
openapi: "GET /users/{id}/"
46+
---
47+
```
48+
49+
```yaml openapi.yaml
50+
paths:
51+
"/users/{id}":
52+
get: ...
53+
```
54+
55+
Notice that the path in the `openapi` field has a trailing slash, whereas the path in the OpenAPI
56+
document does not.
57+
58+
Another common issue is a misspelled filename. If you are specifying a particular OpenAPI document
59+
in the `openapi` field, ensure the filename is correct. For example, if you have two OpenAPI
60+
documents `openapi/v1.json` and `openapi/v2.json`, your metadata might look like this:
61+
62+
```md api-reference/v1/users/get-user.mdx
63+
---
64+
openapi: "v1 GET /users/{id}"
65+
---
66+
```
67+
68+
</Accordion>
69+
70+
<Accordion title="Requests from the API Playground don't work">
71+
If you have a custom domain configured, this could be an issue with your reverse proxy. By
72+
default, requests made via the API Playground start with a `POST` request to the
73+
`/api/request` path on the docs site. If your reverse proxy is configured to only allow `GET`
74+
requests, then all of these requests will fail. To fix this, configure your reverse proxy to
75+
allow `POST` requests to the `/api/request` path.
76+
77+
Alternatively, if your reverse proxy prevents you from accepting `POST` requests, you can configure
78+
Mintlify to send requests directly to your backend with the `api.playground.disableProxy`
79+
setting in the `mint.json`, as described [here](/settings/global#api-configurations). This will
80+
likely require you to configure CORS on your server, as these requests will now come directly
81+
from your users' browsers.
82+
83+
</Accordion>
84+
</AccordionGroup>

changelog/2024-07.mdx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
title: "July 2024"
3+
description: "Introducing the Mintlify Widget and the Pro plan"
4+
---
5+
6+
## Mintlify Widget
7+
8+
For `Pro` users, we introduced Mintlify Widget, an extension of your docs to
9+
answer your users' questions when and where they asked. You can add this
10+
AI-powered chatbot to any web page: your landing page, inside your product, or
11+
on your existing documentation pages.
12+
13+
- [Read the blog announcement](https://mintlify.com/blog/widget)
14+
- [Learn how to install the Widget](/advanced/widget/chat#getting-started)
15+
16+
## Pro Plan
17+
18+
We also updated our pricing plans for better customizability and scale.
19+
20+
- [Read the blog announcement](https://mintlify.com/blog/pro-plan)
21+
22+
## API Playground Code Example Sync
23+
24+
When you browse API docs, the selected code example now syncs across your pages.
25+
26+
## Insights
27+
28+
Currently in beta, this feature summarizes common user questions and patterns
29+
into easy-to-digest reports with AI-powered suggestions on how to improve your
30+
product.

changelog/2024-08.mdx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
title: "August 2024"
3+
description: "Web Editor UI, API Playground Update, and AI Chat"
4+
---
5+
6+
## OpenAPI Reference Pages
7+
8+
- Endpoints defined by OpenAPI that are complex and recursive are now 98%
9+
smaller.
10+
- We now show
11+
[additionalProperties](https://swagger.io/docs/specification/data-models/dictionaries/)
12+
in OpenAPI pages.
13+
14+
## File Uploads in API Playground
15+
16+
By default, API playground requests are proxied by Mintlify. Now you can use
17+
`disableProxy` to disable this behavior and support request types like file
18+
uploads.
19+
20+
- [Learn more about API configurations](/settings/global#api-configurations)
21+
22+
## Mobile SEO improvements
23+
24+
We've fixed the mobile layout of our docs so that they are more SEO-friendly -
25+
including adding proper aria tags to elements.
26+
27+
## Support Form
28+
29+
We added a more detailed support form to the Mintlify dashboard. You can now
30+
submit a form to get in touch with us.
31+
32+
## Bug Fixes
33+
34+
- Fixed a bug for the Segment integration functionality.
35+
- We now raise more granular error messages for GitHub permissions when
36+
interacting with the editor.
37+
- Fixed bugs where the navigation would not properly expand when a direct link
38+
was used.

changelog/2024-09.mdx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: "September 2024"
3+
description: "Speed improvements and JWT Auth"
4+
---
5+
6+
<Info>Last updated on: **2024-09-15**</Info>
7+
8+
## Update Speed Performances
9+
10+
For large projects (~3,000 files), the download step for docs updates is now
11+
~440x faster - a 99.8% time reduction. Across the board, file downloads during
12+
updates are now ~5.5x faster - an 81.8% time reduction.
13+
14+
## Desktop SEO improvements
15+
16+
The navbar hierarchy follows the aria hierarchy. We also added an aria label to
17+
the light/dark mode toggle.
18+
19+
## More
20+
21+
- **Troubleshooting for API pages**: API pages could be complicated so we listed
22+
common issues to help you sort them out quickly —
23+
[Read the docs](/api-playground/troubleshooting)

0 commit comments

Comments
 (0)