Skip to content

Commit aa8c7dd

Browse files
Documentation edits made through Mintlify web editor
1 parent d70b909 commit aa8c7dd

File tree

20 files changed

+349
-1394
lines changed

20 files changed

+349
-1394
lines changed

advanced/user-auth/oauth.mdx

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,37 @@
11
---
22
title: 'OAuth 2.0'
3-
description: 'Integrate with your OAuth server to enable user login via the PKCE flow'
3+
description: 'Enable user login via OAuth PKCE flow'
44
---
55

6-
If you have an existing OAuth server that supports the PKCE flow, you can integrate with Mintlify for a seamless login experience.
6+
Integrate your existing OAuth server with Mintlify to enable user authentication.
77

8-
## Implementation
8+
## Setup Steps
99

1010
<Steps>
11-
<Step title="Create your Info API">
12-
Create an API endpoint that can be accessed with an OAuth access token, and responds with a JSON payload following the [UserInfo](./sending-data) format. Take note of the scope or scopes required to access this endpoint.
11+
<Step title="Create Info API">
12+
Create an API endpoint that accepts an OAuth access token and returns user information in the [UserInfo](./sending-data) format.
1313
</Step>
14-
<Step title="Configure your User Auth settings">
15-
Go to your [Mintlify dashboard settings](https://dashboard.mintlify.com/mintlify/mintlify/settings/deployment/user-authentication), select the OAuth option, and fill out the required fields:
16-
17-
- **Authorization URL**: The base URL for the authorization request, to which we will add the appropriate query parameters.
18-
- **Client ID**: An ID for the OAuth 2.0 client to be used.
19-
- **Scopes**: An array of scopes that will be requested.
20-
- **Token URL**: The base URL for the token exchange request.
21-
- **Info API URL**: The endpoint that will be hit to retrieve user info.
14+
<Step title="Configure OAuth Settings">
15+
In your [Mintlify dashboard](https://dashboard.mintlify.com/mintlify/mintlify/settings/deployment/user-authentication), select OAuth and configure:
16+
- Authorization URL
17+
- Client ID
18+
- Required scopes
19+
- Token URL
20+
- Info API URL
2221
</Step>
23-
<Step title="Configure your OAuth client">
24-
Copy the Redirect URL listed in the [Mintlify dashboard settings](https://dashboard.mintlify.com/mintlify/mintlify/settings/deployment/user-authentication) and add it as an authorized redirect URL for your OAuth server.
22+
<Step title="Add Redirect URL">
23+
Add the Redirect URL from your Mintlify dashboard to your OAuth server's authorized redirects.
2524
</Step>
2625
</Steps>
2726

28-
## Example
29-
30-
I have an existing OAuth server that supports the PKCE flow. I want to set up authentication for my docs hosted at `foo.com/docs`.
31-
32-
To set up authentication with Mintlify, I create an endpoint `api.foo.com/docs/user-info` which requires an OAuth access token with the `docs-user-info` scope, and responds with the user's custom data according to Mintlify’s specification.
33-
34-
I then go to the Mintlify dashboard settings, navigate to the User Auth settings, select OAuth, and enter the relevant values for the OAuth flow and Info API endpoint:
35-
- **Authorization URL**: `https://auth.foo.com/authorization`
36-
- **Client ID**: `ydybo4SD8PR73vzWWd6S0ObH`
37-
- **Scopes**: `['docs-user-info']`
38-
- **Token URL**: `https://auth.foo.com/exchange`
39-
- **Info API URL**: `https://api.foo.com/docs/user-info`
40-
41-
Finally, I copy the Redirect URL displayed in the dashboard settings and add it as an authorized redirect URL in my OAuth client configuration settings.
27+
## Example Configuration
28+
29+
```json
30+
{
31+
"authorizationUrl": "https://auth.foo.com/authorization",
32+
"clientId": "ydybo4SD8PR73vzWWd6S0ObH",
33+
"scopes": ["docs-user-info"],
34+
"tokenUrl": "https://auth.foo.com/exchange",
35+
"infoApiUrl": "https://api.foo.com/docs/user-info"
36+
}
37+
```
Lines changed: 25 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,39 @@
11
---
22
title: 'Shared Session Auth'
3-
description: 'Seamlessly share user sessions between your dashboard and your docs'
3+
description: 'Share user sessions between your dashboard and docs'
44
---
55

6-
This method utilizes the session authentication info already stored in your user’s browser to create a seamless documentation experience.
6+
Share your existing user sessions between your dashboard and documentation for a seamless experience.
77

8-
## Implementation
8+
## Setup
99

1010
<Steps>
11-
<Step title="Create your Info API">
12-
Create an API endpoint that uses session authentication to identify users, and responds with a JSON payload following the [UserInfo](./sending-data) format.
13-
14-
If the API domain does not *exactly match* the docs domain:
15-
- Add the docs domain to your API's `Access-Control-Allow-Origin` header (must not be `*`)
16-
- Ensure your API’s `Access-Control-Allow-Credentials` header is `true`
17-
<Warning>
18-
These CORS options only need to be enabled on the *single endpoint* responsible for returning user information. We do not recommend enabling these options on all dashboard endpoints.
19-
</Warning>
11+
<Step title="Create User Info API">
12+
Create an API endpoint that:
13+
- Uses your existing session authentication
14+
- Returns user data in the [UserInfo](./sending-data) format
15+
- Sets proper CORS headers if your API and docs domains differ:
16+
- `Access-Control-Allow-Origin`: Set to your docs domain
17+
- `Access-Control-Allow-Credentials`: Set to `true`
2018
</Step>
21-
<Step title="Configure your User Auth settings">
22-
Go to your [Mintlify dashboard settings](https://dashboard.mintlify.com/mintlify/mintlify/settings/deployment/user-authentication) and add the API URL and your Login URL to your User Auth settings.
19+
<Step title="Configure Settings">
20+
Add your API URL and Login URL in your [Mintlify dashboard settings](https://dashboard.mintlify.com/mintlify/mintlify/settings/deployment/user-authentication).
2321
</Step>
2422
</Steps>
2523

26-
## Examples
27-
28-
### Dashboard at subdomain, docs at subdomain
29-
30-
I have a dashboard at `dash.foo.com`, which uses cookie-based session authentication. My dashboard API routes are hosted at `dash.foo.com/api`. I want to set up authentication for my docs hosted at `docs.foo.com`.
31-
32-
To set up authentication with Mintlify, I create another dashboard endpoint `dash.foo.com/api/docs/user-info` which identifies the user using session auth, and responds with their custom data according to Mintlify’s specification. I then add `https://docs.foo.com` to the `Access-Control-Allow-Origin` allow-list **for this route only**, and ensure my `Access-Control-Allow-Credentials` configuration is set to `true` **for this route only**.
33-
34-
I then go to the Mintlify dashboard settings and enter `https://dash.foo.com/api/docs/user-info` for the API URL field.
35-
36-
### Dashboard at subdomain, docs at root
37-
38-
I have a dashboard at `dash.foo.com`, which uses cookie-based session authentication. My dashboard API routes are hosted at `dash.foo.com/api`. I want to set up authentication for my docs hosted at `foo.com/docs`.
39-
40-
To set up authentication with Mintlify, I create another dashboard endpoint `dash.foo.com/api/docs/user-info` which identifies the user using session auth, and responds with their custom data according to Mintlify’s specification. I then add `https://foo.com` to the `Access-Control-Allow-Origin` allow-list **for this route only**, and ensure my `Access-Control-Allow-Credentials` configuration is set to `true` **for this route only**.
41-
42-
I then go to the Mintlify dashboard settings and enter `https://dash.foo.com/api/docs/user-info` for the API URL field.
43-
44-
### Dashboard at root, docs at root
24+
## Common Setups
4525

46-
I have a dashboard at `foo.com/dashboard`, which uses cookie-based session authentication. My dashboard API routes are hosted at `foo.com/api`. I want to set up authentication for my docs hosted at `foo.com/docs`.
26+
1. **Docs and Dashboard on Subdomains**
27+
- Dashboard: `dash.foo.com`
28+
- Docs: `docs.foo.com`
29+
- API Endpoint: `dash.foo.com/api/docs/user-info`
4730

48-
To set up authentication with Mintlify, I create another dashboard endpoint `foo.com/api/docs/user-info` which identifies the user using session auth, and responds with their custom data according to Mintlify’s specification.
31+
2. **Dashboard on Subdomain, Docs on Root**
32+
- Dashboard: `dash.foo.com`
33+
- Docs: `foo.com/docs`
34+
- API Endpoint: `dash.foo.com/api/docs/user-info`
4935

50-
I then go to the Mintlify dashboard settings and enter `https://foo.com/api/docs/user-info` for the API URL field.
36+
3. **Both on Root Domain**
37+
- Dashboard: `foo.com/dashboard`
38+
- Docs: `foo.com/docs`
39+
- API Endpoint: `foo.com/api/docs/user-info`

advanced/widget/chat.mdx

Lines changed: 14 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,16 @@
22
title: "Chat Widget"
33
---
44

5-
Integrate the Mintlify widget into your products to offer users quick access to AI-powered chat with your docs content as the knowledge base.
5+
Add an AI-powered chat widget to your product that lets users search your documentation.
66

77
![widget](https://mintlify-assets.b-cdn.net/widget/hero.webp)
88

9-
## Getting started
9+
## Quick Start
1010

11-
First, generate an API key in [the Mintlify dashboard](https://dashboard.mintlify.com/chat/widget-auth).
12-
13-
![widget](https://mintlify-assets.b-cdn.net/widget/key.webp)
14-
15-
## Installation
16-
17-
Add the widget by adding these script tags into your site's `<head>...<head/>` tag.
11+
1. Get your API key from the [Mintlify dashboard](https://dashboard.mintlify.com/chat/widget-auth)
12+
2. Add the widget to your site:
1813

14+
### HTML Installation
1915
```html
2016
<script>
2117
window.mintlifyWidgetSettings = {
@@ -37,8 +33,7 @@ Add the widget by adding these script tags into your site's `<head>...<head/>` t
3733
</script>
3834
```
3935

40-
To use the widget in React and Next.js apps, use the React component from the `@mintlify/widget-react` [package](https://www.npmjs.com/package/@mintlify/widget-react). Here is a basic example of how to use the component in your React application:
41-
36+
### React Installation
4237
```jsx
4338
<MintlifyWidget
4439
connection={{
@@ -47,73 +42,14 @@ To use the widget in React and Next.js apps, use the React component from the `@
4742
/>
4843
```
4944

50-
## Usage
51-
52-
In the first script tag or the React component props, you can customize the appearance and other settings of the widget. `mintlifyWidgetSettings` accepts the following props:
53-
54-
| Prop | Type | Description |
55-
| ------------ | ------------------------------------------------------------------- | ---------------------------------------------------------- |
56-
| `connection` | [MintlifyWidgetConnectionProps](#mintlifywidgetconnectionProps) | Information needed to connect to our API. Required. |
57-
| `display?` | [MintlifyWidgetDisplayProps](#mintlifywidgetdisplayProps) | Configurations for the widget appearance and interactions. |
58-
| `tracking?` | [MintlifyWidgetTrackingFunctions](#mintlifywidgettrackingfunctions) | Callback functions for tracking analytics. |
59-
60-
### MintlifyWidgetConnectionProps
61-
62-
| Prop | Type | Description |
63-
| -------- | -------- | ----------------------------------------------------------- |
64-
| `apiKey` | `string` | Widget API key generated from Mintlify dashboard. Required. |
65-
| `url?` | `string` | Used for internal testing only |
66-
67-
### MintlifyWidgetDisplayProps
68-
69-
| Prop | Type | Description |
70-
| ------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------- |
71-
| `trigger?` | [MintlifyWidgetDisplayTriggerProps](#mintlifywidgetdisplaytriggerprops) | Appearance of the trigger. |
72-
| `colors?` | [MintlifyWidgetDisplayColorsProps](#mintlifywidgetdisplaycolorsprops) | Colors used across the widget. |
73-
| `chat?` | [MintlifyWidgetDisplayChatProps](#mintlifywidgetdisplaychatprops) | Configs specific to AI chat. |
74-
| `isDarkMode?` | `boolean` | Controlled dark mode appearance. Defaults to OS preference. |
75-
76-
#### MintlifyWidgetDisplayTriggerProps
77-
78-
| Prop | Type | Description |
79-
| ------------- | ------------------------------------ | -------------------------------------------------------------------------------------------------------------------------- |
80-
| `type?` | `'button'`\|`'input'` | Type of the trigger to display. Defaults to `button`. |
81-
| `label?` | `string` | Label displayed in the trigger. Defaults to `Get help` for the button trigger and `Ask anything...` for the input trigger. |
82-
| `buttonIcon?` | `'chat'`\|`'sparkles'`\|`'mintlify'` | Icon used in the trigger. Only available for the `button` trigger. Defaults to `chat`. |
83-
| `iconOnly?` | `boolean` | Only show icon in the trigger or not. Defaults to `false`. |
84-
85-
Here is an overview of what the trigger looks like with different configurations.
86-
87-
| `type='input'` | |
88-
| -------------- | ------------------------------------------------------------ |
89-
| | <img style={{height:'80px'}} src="https://mintlify-assets.b-cdn.net/widget/input.png"/> |
90-
91-
| `type='button'` | `'chat'` | `'sparkles'` | `'mintlify'` |
92-
| ---------------- | --------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
93-
| `iconOnly=false` | <img style={{height:'80px'}} src="https://mintlify-assets.b-cdn.net/widget/button-chat.png"/> | <img style={{height:'80px'}} src="https://mintlify-assets.b-cdn.net/widget/button-sparkles.png"/> | <img style={{height:'80px'}} src="https://mintlify-assets.b-cdn.net/widget/button-mintlify.png"/> |
94-
| `iconOnly=true` | <img style={{height:'80px'}} src="https://mintlify-assets.b-cdn.net/widget/button-chat-iconOnly.png"/> | <img style={{height:'80px'}} src="https://mintlify-assets.b-cdn.net/widget/button-sparkles-iconOnly.png"/> | <img style={{height:'80px'}} src="https://mintlify-assets.b-cdn.net/widget/button-mintlify-iconOnly.png"/> |
95-
96-
#### MintlifyWidgetDisplayColorsProps
97-
98-
| Prop | Type | Description |
99-
| --------------- | -------- | -------------------------------------------------------- |
100-
| `primary?` | `string` | Primary color used in the widget. Defaults to `#0D9373`. |
101-
| `primaryLight?` | `string` | Primary color in dark mode. Defaults to `#55D799`. |
102-
103-
#### MintlifyWidgetDisplayChatProps
45+
## Customization
10446

105-
| Prop | Type | Description |
106-
| ------------------------ | ---------- | ------------------------------------------------------------------ |
107-
| `openCitationInSameTab?` | `boolean` | Open the citation url in the same tab or not. Defaults to `false`. |
108-
| `exampleQueries?` | `string[]` | Example queries to prompt the user to ask. Defaults to `[]`. |
47+
The widget can be customized using these main properties:
10948

110-
### MintlifyWidgetTrackingFunctions
49+
| Property | Description |
50+
|------------|-----------------------------------------------------|
51+
| `connection` | Required. Contains your API key |
52+
| `display` | Optional. Customize appearance and interactions |
53+
| `tracking` | Optional. Add analytics tracking |
11154

112-
| Prop | Type | Description |
113-
| --------------------- | ------------------------------------------ | -------------------------------------------------- |
114-
| `trackChatEnter` | `()=> void` | Triggered when the user opens the chat widget. |
115-
| `trackCitationClick` | `(title: string, url: string)=> void` | Triggered when the user clicks on a citation. |
116-
| `trackChatThumbsUp` | `(query: string, response: string)=> void` | Triggered when the user thumbs up on a response. |
117-
| `trackChatThumbsDown` | `(query: string, response: string)=> void` | Triggered when the user thumbs down on a response. |
118-
| `trackChatFollowup` | `(query: string)=> void` | Triggered when the user asks a question. |
119-
| `trackChatClose` | `(queriesCount: number)=> void` | Triggered when the user exits the chat widget. |
55+
[View detailed configuration options →](https://mintlify.com/docs/widget/configuration)

api-playground/mdx/configuration.mdx

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,24 @@ title: 'MDX Setup'
33
description: 'Generate docs pages for your API endpoints using MDX'
44
---
55

6-
Mintlify allows you to define your API endpoints using a combination of `mint.json` configuration, MDX metadata fields, and the `<ParamFields />` component. From the defined endpoints, we generate an API playground, request examples, and response examples.
6+
Mintlify helps you create interactive API documentation using MDX. Here's how to get started:
77

88
<Steps>
9-
<Step title="Configure your API">
10-
In your `mint.json` file, define your base URL and auth method:
9+
<Step title="Configure API in mint.json">
10+
Add your API configuration to `mint.json`:
1111

1212
```json
1313
{
1414
"api": {
15-
"baseUrl": "https://mintlify.com/api", // string array for multiple base URLs
15+
"baseUrl": "https://mintlify.com/api",
1616
"auth": {
17-
"method": "bearer" // options: bearer, basic, key.
17+
"method": "bearer"
1818
}
1919
}
2020
}
2121
```
2222

23-
If you would not like to show an API playground, you don't need to include auth types. Hide the playground with the following field:
24-
23+
To hide the API playground, use:
2524
```json
2625
{
2726
"api": {
@@ -31,35 +30,25 @@ Mintlify allows you to define your API endpoints using a combination of `mint.js
3130
}
3231
}
3332
```
34-
35-
Find a full list of API configurations [here](/settings/global#api-configurations).
3633
</Step>
3734

38-
<Step title="Create your endpoint pages">
39-
40-
Each API endpoint page should have a corresponding MDX file. At the top of each file, define:
35+
<Step title="Create endpoint pages">
36+
Create MDX files for each endpoint with the required metadata:
4137

4238
```md
4339
---
4440
title: 'Create new user'
45-
api: 'POST https://api.mintlify.com/user'
41+
api: 'POST /user'
4642
---
4743
```
4844

49-
You can specify path parameters by adding the parameter name to the path, wrapped with `{}`:
50-
45+
For paths with parameters, use `{paramName}` syntax:
5146
```bash
52-
https://api.example.com/v1/endpoint/{userId}
47+
/v1/endpoint/{userId}
5348
```
54-
55-
<Note>
56-
57-
If you have `baseUrl` configured in [mint.json](/settings/global), you can use relative paths like `/v1/endpoint`.
58-
59-
</Note>
6049
</Step>
6150

62-
<Step title="Add your endpoints to your docs">
63-
Add your endpoint pages to the sidebar by adding the paths to the `navigation` field in your `mint.json`. Learn more about structuring your docs [here](/settings/navigation).
51+
<Step title="Add to navigation">
52+
Add your endpoint pages to the `navigation` field in `mint.json` to display them in your sidebar.
6453
</Step>
65-
</Steps>
54+
</Steps>

0 commit comments

Comments
 (0)