Skip to content

Commit d0a2b38

Browse files
committed
add auth keyword to auth pages
1 parent 11d1019 commit d0a2b38

File tree

3 files changed

+123
-98
lines changed

3 files changed

+123
-98
lines changed

authentication-personalization/authentication-setup.mdx

Lines changed: 73 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22
title: "Authentication setup"
33
description: "Guarantee privacy of your docs by authenticating users"
44
icon: "file-lock"
5+
keywords: ["auth"]
56
---
7+
68
Authentication requires users to log in before accessing your documentation. This guide covers setup for each available handshake method.
79

810
**Need help choosing?** See the [overview](/authentication-personalization/overview) to compare options.
911

1012
<Info>
11-
Authentication methods are available on [Growth and Enterprise plans](https://mintlify.com/pricing?ref=authentication).
13+
Authentication methods are available on [Growth and Enterprise
14+
plans](https://mintlify.com/pricing?ref=authentication).
1215
</Info>
1316

1417
## Configuring authentication
@@ -19,26 +22,28 @@ Select the handshake method that you want to configure.
1922
<Tab title="JWT">
2023
### Prerequisites
2124

22-
* An authentication system that can generate and sign JWTs.
23-
* A backend service that can create redirect URLs.
25+
- An authentication system that can generate and sign JWTs.
26+
- A backend service that can create redirect URLs.
2427

2528
### Implementation
2629

2730
<Steps>
2831
<Step title="Generate a private key.">
29-
1. In your dashboard, go to [Authentication](https://dashboard.mintlify.com/settings/deployment/authentication).
30-
2. Select **Full Authentication** or **Partial Authentication**.
31-
3. Select **JWT**.
32-
4. Enter the URL of your existing login flow and select **Save changes**.
33-
5. Select **Generate new key**.
34-
6. Store your key securely where it can be accessed by your backend.
32+
1. In your dashboard, go to
33+
[Authentication](https://dashboard.mintlify.com/settings/deployment/authentication).
34+
2. Select **Full Authentication** or **Partial Authentication**. 3. Select
35+
**JWT**. 4. Enter the URL of your existing login flow and select **Save
36+
changes**. 5. Select **Generate new key**. 6. Store your key securely where
37+
it can be accessed by your backend.
3538
</Step>
3639
<Step title="Integrate Mintlify authentication into your login flow.">
37-
Modify your existing login flow to include these steps after user authentication:
38-
39-
* Create a JWT containing the authenticated user's info in the `User` format. See [Sending Data](/authentication-personalization/sending-data) for more information.
40-
* Sign the JWT with your secret key, using the EdDSA algorithm.
41-
* Create a redirect URL back to the `/login/jwt-callback` path of your docs, including the JWT as the hash.
40+
Modify your existing login flow to include these steps after user
41+
authentication: * Create a JWT containing the authenticated user's info in
42+
the `User` format. See [Sending
43+
Data](/authentication-personalization/sending-data) for more information. *
44+
Sign the JWT with your secret key, using the EdDSA algorithm. * Create a
45+
redirect URL back to the `/login/jwt-callback` path of your docs, including
46+
the JWT as the hash.
4247
</Step>
4348
</Steps>
4449

@@ -49,15 +54,16 @@ Your documentation is hosted at `docs.foo.com` with an existing authentication s
4954
Create a login endpoint at `https://foo.com/docs-login` that extends your existing authentication.
5055

5156
After verifying user credentials:
52-
* Generate a JWT with user data in Mintlify's format.
53-
* Sign the JWT and redirect to `https://docs.foo.com/login/jwt-callback#{SIGNED_JWT}`.
57+
58+
- Generate a JWT with user data in Mintlify's format.
59+
- Sign the JWT and redirect to `https://docs.foo.com/login/jwt-callback#{SIGNED_JWT}`.
5460

5561
<CodeGroup>
5662
```ts TypeScript
5763
import * as jose from 'jose';
5864
import { Request, Response } from 'express';
5965

60-
const TWO_WEEKS_IN_MS = 1000 * 60 * 60 * 24 * 7 * 2;
66+
const TWO_WEEKS_IN_MS = 1000 _ 60 _ 60 _ 24 _ 7 \* 2;
6167

6268
const signingKey = await jose.importPKCS8(process.env.MINTLIFY_PRIVATE_KEY, 'EdDSA');
6369

@@ -71,14 +77,15 @@ export async function handleRequest(req: Request, res: Response) {
7177
},
7278
};
7379

74-
const jwt = await new jose.SignJWT(user)
75-
.setProtectedHeader({ alg: 'EdDSA' })
76-
.setExpirationTime('10 s') // 10 second JWT expiration
77-
.sign(signingKey);
80+
const jwt = await new jose.SignJWT(user)
81+
.setProtectedHeader({ alg: 'EdDSA' })
82+
.setExpirationTime('10 s') // 10 second JWT expiration
83+
.sign(signingKey);
7884

79-
return res.redirect(`https://docs.foo.com/login/jwt-callback#${jwt}`);
85+
return res.redirect(`https://docs.foo.com/login/jwt-callback#${jwt}`);
8086
}
81-
```
87+
88+
````
8289

8390
```python Python
8491
import jwt # pyjwt
@@ -106,7 +113,8 @@ async def return_mintlify_auth_status(current_user):
106113
)
107114
108115
return RedirectResponse(url=f'https://docs.foo.com/login/jwt-callback#{jwt_token}', status_code=302)
109-
```
116+
````
117+
110118
</CodeGroup>
111119
112120
### Redirecting unauthenticated users
@@ -117,38 +125,42 @@ When an unauthenticated user tries to access a protected page, their intended de
117125
2. Redirect to your login URL with a redirect query parameter: `https://foo.com/docs-login?redirect=%2Fquickstart`.
118126
3. After authentication, redirect to `https://docs.foo.com/login/jwt-callback?redirect=%2Fquickstart#{SIGNED_JWT}`.
119127
4. User lands in their original destination.
120-
</Tab>
128+
</Tab>
121129
<Tab title="OAuth 2.0">
130+
122131
### Prerequisites
123132

124-
* An OAuth server that supports the Authorization Code Flow.
125-
* Ability to create an API endpoint accessible by OAuth access tokens (optional, to enable personalization features).
133+
- An OAuth server that supports the Authorization Code Flow.
134+
- Ability to create an API endpoint accessible by OAuth access tokens (optional, to enable personalization features).
126135

127136
### Implementation
128137

129138
<Steps>
130139
<Step title="Configure your OAuth settings.">
131-
1. In your dashboard, go to [Authentication](https://dashboard.mintlify.com/settings/deployment/authentication).
132-
2. Select **Full Authentication** or **Partial Authentication**.
133-
3. Select **OAuth** and configure these fields:
134-
* **Authorization URL**: Your OAuth endpoint.
135-
* **Client ID**: Your OAuth 2.0 client identifier.
136-
* **Client Secret**: Your OAuth 2.0 client secret.
137-
* **Scopes**: Permissions to request. Use multiple scopes if you need different access levels.
138-
* **Token URL**: Your OAuth token exchange endpoint.
139-
* **Info API URL** (optional): Endpoint to retrieve user info for personalization. If omitted, the OAuth flow will only be used to verify identity and the user info will be empty.
140+
1. In your dashboard, go to
141+
[Authentication](https://dashboard.mintlify.com/settings/deployment/authentication).
142+
2. Select **Full Authentication** or **Partial Authentication**. 3. Select
143+
**OAuth** and configure these fields: * **Authorization URL**: Your OAuth
144+
endpoint. * **Client ID**: Your OAuth 2.0 client identifier. * **Client
145+
Secret**: Your OAuth 2.0 client secret. * **Scopes**: Permissions to
146+
request. Use multiple scopes if you need different access levels. * **Token
147+
URL**: Your OAuth token exchange endpoint. * **Info API URL** (optional):
148+
Endpoint to retrieve user info for personalization. If omitted, the OAuth
149+
flow will only be used to verify identity and the user info will be empty.
140150
4. Select **Save changes**.
141151
</Step>
142152
<Step title="Configure your OAuth server.">
143-
1. Copy the **Redirect URL** from your [authentication settings](https://dashboard.mintlify.com/settings/deployment/authentication).
153+
1. Copy the **Redirect URL** from your [authentication
154+
settings](https://dashboard.mintlify.com/settings/deployment/authentication).
144155
2. Add the redirect URL as an authorized redirect URL for your OAuth server.
145156
</Step>
146157
<Step title="Create your user info endpoint (optional).">
147-
To enable personalization features, create an API endpoint that:
148-
* Accepts OAuth access tokens for authentication.
149-
* Returns user data in the `User` format. See [Sending Data](/authentication-personalization/sending-data) for more information.
150-
151-
Add this endpoint URL to the **Info API URL** field in your [authentication settings](https://dashboard.mintlify.com/settings/deployment/authentication).
158+
To enable personalization features, create an API endpoint that: * Accepts
159+
OAuth access tokens for authentication. * Returns user data in the `User`
160+
format. See [Sending Data](/authentication-personalization/sending-data) for
161+
more information. Add this endpoint URL to the **Info API URL** field in
162+
your [authentication
163+
settings](https://dashboard.mintlify.com/settings/deployment/authentication).
152164
</Step>
153165
</Steps>
154166

@@ -157,6 +169,7 @@ When an unauthenticated user tries to access a protected page, their intended de
157169
Your documentation is hosted at `foo.com/docs` and you have an existing OAuth server at `auth.foo.com` that supports the Authorization Code Flow.
158170

159171
**Configure your OAuth server details** in your dashboard:
172+
160173
- **Authorization URL**: `https://auth.foo.com/authorization`
161174
- **Client ID**: `ydybo4SD8PR73vzWWd6S0ObH`
162175
- **Scopes**: `['docs-user-info']`
@@ -176,25 +189,27 @@ Your documentation is hosted at `foo.com/docs` and you have an existing OAuth se
176189
```
177190

178191
**Configure your OAuth server to allow redirects** to your callback URL.
192+
179193
</Tab>
180194
<Tab title="Mintlify Dashboard">
181195
### Prerequisites
182196

183-
* Your documentation users are also your documentation editors.
197+
- Your documentation users are also your documentation editors.
184198

185199
### Implementation
186200

187201
<Steps>
188202
<Step title="Enable Mintlify dashboard authentication.">
189-
1. In your dashboard, go to [Authentication](https://dashboard.mintlify.com/settings/deployment/authentication).
190-
2. Select **Full Authentication** or **Partial Authentication**.
191-
3. Select **Mintlify Auth**.
192-
4. Select **Enable Mintlify Auth**.
203+
1. In your dashboard, go to
204+
[Authentication](https://dashboard.mintlify.com/settings/deployment/authentication).
205+
2. Select **Full Authentication** or **Partial Authentication**. 3. Select
206+
**Mintlify Auth**. 4. Select **Enable Mintlify Auth**.
193207
</Step>
194208
<Step title="Add authorized users.">
195-
1. In your dashboard, go to [Members](https://dashboard.mintlify.com/settings/organization/members).
196-
2. Add each person who should have access to your documentation.
197-
3. Assign appropriate roles based on their editing permissions.
209+
1. In your dashboard, go to
210+
[Members](https://dashboard.mintlify.com/settings/organization/members). 2.
211+
Add each person who should have access to your documentation. 3. Assign
212+
appropriate roles based on their editing permissions.
198213
</Step>
199214
</Steps>
200215

@@ -205,6 +220,7 @@ Your documentation is hosted at `docs.foo.com` and your team uses the dashboard
205220
**Enable Mintlify authentication** in your dashboard settings.
206221

207222
**Verify team access** by checking that all team members are added to your organization.
223+
208224
</Tab>
209225
<Tab title="Password">
210226
<Info>
@@ -213,17 +229,16 @@ Password authentication provides access control only and does **not** support co
213229

214230
### Prerequisites
215231

216-
* Your security requirements allow sharing passwords among users.
232+
- Your security requirements allow sharing passwords among users.
217233

218234
### Implementation
219235

220236
<Steps>
221237
<Step title="Create a password.">
222-
1. In your dashboard, go to [Authentication](https://dashboard.mintlify.com/settings/deployment/authentication).
223-
2. Select **Full Authentication** or **Partial Authentication**.
224-
3. Select **Password**.
225-
4. Enter a secure password.
226-
5. Select **Save changes**.
238+
1. In your dashboard, go to
239+
[Authentication](https://dashboard.mintlify.com/settings/deployment/authentication).
240+
2. Select **Full Authentication** or **Partial Authentication**. 3. Select
241+
**Password**. 4. Enter a secure password. 5. Select **Save changes**.
227242
</Step>
228243
<Step title="Distribute access.">
229244
Securely share the password and documentation URL with authorized users.
@@ -232,8 +247,9 @@ Password authentication provides access control only and does **not** support co
232247

233248
## Example
234249

235-
Your documentation is hosted at `docs.foo.com` and you need basic access control without tracking individual users. You want to prevent public access while keeping setup simple.
250+
Your documentation is hosted at `docs.foo.com` and you need basic access control without tracking individual users. You want to prevent public access while keeping setup simple.
236251

237252
**Create a strong password** in your dashboard. **Share credentials** with authorized users. That's it!
253+
238254
</Tab>
239255
</Tabs>

authentication-personalization/overview.mdx

Lines changed: 49 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@
22
title: "Overview"
33
description: "Control who sees your documentation and customize their experience"
44
icon: "badge-info"
5+
keywords: ["auth"]
56
---
7+
68
<Info>
7-
Authentication methods are available on the [Growth and Enterprise plans](https://mintlify.com/pricing?ref=authentication).
9+
Authentication methods are available on the [Growth and Enterprise
10+
plans](https://mintlify.com/pricing?ref=authentication).
811
</Info>
912

1013
There are three approaches to manage access and customize your documentation based on user information.
1114

12-
* **Authentication**: Complete privacy protection for all content with full content customization.
13-
* **Partial authentication**: Page-by-page access control with full content customization.
14-
* **Personalization**: Content customization with **no security guarantees**. All content remains publicly accessible.
15+
- **Authentication**: Complete privacy protection for all content with full content customization.
16+
- **Partial authentication**: Page-by-page access control with full content customization.
17+
- **Personalization**: Content customization with **no security guarantees**. All content remains publicly accessible.
1518

1619
**Choose authentication** if you need complete security and privacy for all your documentation, including pages, images, search results, and AI assistant features.
1720

@@ -26,50 +29,55 @@ Authentication and personalization offer multiple handshake methods for controll
2629
### Available for all methods
2730

2831
**JSON Web Token (JWT)**: Custom system where you manage user tokens with full control over the login flow.
29-
* Pros of JWT:
30-
* Reduced risk of API endpoint abuse.
31-
* No CORS configuration.
32-
* No restrictions on API URLs.
33-
* Cons of JWT:
34-
* Must be compatible with your existing login flow.
35-
* Dashboard sessions and docs authentication are decoupled, so your team will log into your dashboard and your docs separately.
36-
* When you refresh user data, users must log into your docs again. If your users' data changes frequently, they must log in frequently or risk having stale data in your docs.
32+
33+
- Pros of JWT:
34+
- Reduced risk of API endpoint abuse.
35+
- No CORS configuration.
36+
- No restrictions on API URLs.
37+
- Cons of JWT:
38+
- Must be compatible with your existing login flow.
39+
- Dashboard sessions and docs authentication are decoupled, so your team will log into your dashboard and your docs separately.
40+
- When you refresh user data, users must log into your docs again. If your users' data changes frequently, they must log in frequently or risk having stale data in your docs.
3741

3842
**OAuth 2.0**: Third-party login integration like Google, GitHub, or other OAuth providers.
39-
* Pros of OAuth 2.0:
40-
* Heightened security standard.
41-
* No restrictions on API URLs.
42-
* Cons of OAuth 2.0:
43-
* Requires significant work if setting up an OAuth server for the first time.
44-
* Dashboard sessions and docs authentication are decoupled, so your team will log into your dashboard and your docs separately.
4543

46-
### Available for authentication and partial authentication
44+
- Pros of OAuth 2.0:
45+
- Heightened security standard.
46+
- No restrictions on API URLs.
47+
- Cons of OAuth 2.0:
48+
- Requires significant work if setting up an OAuth server for the first time.
49+
- Dashboard sessions and docs authentication are decoupled, so your team will log into your dashboard and your docs separately.
50+
51+
### Available for authentication and partial authentication
4752

4853
**Mintlify dashboard**: Allow all of your dashboard users to access your docs.
49-
* Pros of Mintlify dashboard:
50-
* No configuration required.
51-
* Enables private preview deployments, restricting access to authenticated users only.
52-
* Cons of Mintlify dashboard:
53-
* Requires all users of your docs to have an account in your Mintlify dashboard.
54+
55+
- Pros of Mintlify dashboard:
56+
- No configuration required.
57+
- Enables private preview deployments, restricting access to authenticated users only.
58+
- Cons of Mintlify dashboard:
59+
- Requires all users of your docs to have an account in your Mintlify dashboard.
5460

5561
**Password**: Shared access with a single global password. Used for access control only. Does not allow for personalization.
56-
* Pros of password:
57-
* Simple setup with no configuration required to add new users, just share the password.
58-
* Cons of password:
59-
* Lose personalization features since there is no way to differentiate users with the same password.
60-
* Must change the password to revoke access.
62+
63+
- Pros of password:
64+
- Simple setup with no configuration required to add new users, just share the password.
65+
- Cons of password:
66+
- Lose personalization features since there is no way to differentiate users with the same password.
67+
- Must change the password to revoke access.
6168

6269
### Available for personalization
6370

6471
**Shared session**: Use the same session token as your dashboard to personalize content.
65-
* Pros of shared session:
66-
* Users that are logged into your dashboard are automatically logged into your docs.
67-
* User sessions are persistent so you can refresh data without requiring a new login.
68-
* Minimal setup.
69-
* Cons of shared session:
70-
* Your docs will make a request to your backend.
71-
* You must have a dashboard that uses session authentication.
72-
* CORS configuration is generally required.
72+
73+
- Pros of shared session:
74+
- Users that are logged into your dashboard are automatically logged into your docs.
75+
- User sessions are persistent so you can refresh data without requiring a new login.
76+
- Minimal setup.
77+
- Cons of shared session:
78+
- Your docs will make a request to your backend.
79+
- You must have a dashboard that uses session authentication.
80+
- CORS configuration is generally required.
7381

7482
## Content customization
7583

@@ -108,10 +116,10 @@ Authentication is an enterprise feature. {
108116
```
109117
110118
<Note>
111-
The information in `user` is only available for logged in users. For
112-
logged out users, the value of `user` will be `{}`. To prevent the page from
113-
crashing for logged out users, always use optional chaining on your `user`
114-
fields. For example, `{user.org?.plan}`.
119+
The information in `user` is only available for logged in users. For logged
120+
out users, the value of `user` will be `{}`. To prevent the page from crashing
121+
for logged out users, always use optional chaining on your `user` fields. For
122+
example, `{user.org?.plan}`.
115123
</Note>
116124
117125
### API key prefilling

authentication-personalization/partial-authentication-setup.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: "Partial authentication setup"
33
description: "Control access to specific pages"
44
icon: "file-lock-2"
5+
keywords: ["auth"]
56
---
67

78
Partial authentication lets you protect private documentation while keeping other pages publicly viewable. Users can browse public content freely and authenticate only when accessing protected pages.

0 commit comments

Comments
 (0)