Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions customize/custom-scripts.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Custom scripts"
description: "Add custom JavaScript and CSS for analytics, widgets, styling, third-party integrations, and API Playground server variables on your documentation site."
description: "Add custom JavaScript and CSS for analytics, widgets, styling, third-party integrations, and API playground server variables on your documentation site."
keywords: ["CSS", "JavaScript", "Tailwind CSS", "style customization", "API Playground", "server variables"]
---

Expand Down Expand Up @@ -269,7 +269,7 @@
- `contextual-feedback-form-submit-button`: Submit button for the contextual feedback form.
</Accordion>
<Accordion title="Code snippet feedback">
- `code-snippet-feedback-popover-content`: Popover content for code snippet feedback.

Check warning on line 272 in customize/custom-scripts.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

customize/custom-scripts.mdx#L272

Use 'popover' instead of 'Popover'.
- `code-snippet-feedback-form`: Feedback form for a code snippet.
- `code-snippet-feedback-textarea`: Text area within the code snippet feedback form.
- `code-snippet-feedback-form-title`: Title of the code snippet feedback form.
Expand Down Expand Up @@ -359,7 +359,7 @@

## Custom JavaScript

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

Mintlify includes any `.js` file inside your content directory on every page of your site. Custom JavaScript files run after the page becomes interactive. You cannot scope them to specific pages. When you include multiple `.js` files, they run without a guaranteed order.

Expand Down Expand Up @@ -388,21 +388,21 @@
Use with caution to avoid introducing security vulnerabilities.
</Warning>

### Set API Playground server variables
### Set API playground server variables

Use `window.mintlify.api.playground.setServerVariables` to prefill [OpenAPI server variables](/api-playground/openapi-setup) from custom JavaScript. Use it when values become available after page load. For example, after authentication or a tenant change.

Pass an object of string values. Each call replaces the previous runtime values, which take precedence over OpenAPI defaults and saved values.

```js Set API Playground server variables
```js Set API playground server variables
window.mintlify.api.playground.setServerVariables({
tenantDomain: 'example.us.auth0.com',
});
```

To remove the runtime values, call:

```js Clear API Playground server variables
```js Clear API playground server variables
window.mintlify.api.playground.clearServerVariables();
```

Expand All @@ -416,7 +416,7 @@

If your site uses [authentication](/deploy/authentication-setup) or [personalization](/create/personalization), custom scripts can read the identified visitor from `window.mintlify.user`. This is the same object exposed to MDX pages as the [`user` variable](/create/personalization#dynamic-mdx-content), so it reflects the `content` field of your user data.

Because custom scripts run before user info resolves, listen for the `mintlify:user` event to identify when the user object is available. The event fires when user info resolves and again on any change. Its `detail` is the user object, or `null` when the visitor is signed out or unidentified.

Check warning on line 419 in customize/custom-scripts.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

customize/custom-scripts.mdx#L419

In general, use active voice instead of passive voice ('is signed').

```js Read the user after it resolves
window.addEventListener('mintlify:user', (event) => {
Expand All @@ -436,7 +436,7 @@
}
```

`window.mintlify.user` is `undefined` until user info resolves and when the visitor is signed out or unidentified. Use optional chaining when reading nested fields.

Check warning on line 439 in customize/custom-scripts.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

customize/custom-scripts.mdx#L439

In general, use active voice instead of passive voice ('is signed').

<Warning>
Client-side scripts can access anything you place in the user `content` field. Do not include secrets or credentials that shouldn't be readable in the browser.
Expand Down
18 changes: 9 additions & 9 deletions deploy/authentication-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

Use this comparison to pick the method that fits your use case. See [Feature availability](#feature-availability) for how each method interacts with other Mintlify features.

| Method | Best for | Plan | Group-based access | API playground pre-fill | Personalization |
| Method | Best for | Plan | Group-based access | API playground prefill | Personalization |
| :--- | :--- | :--- | :---: | :---: | :---: |
| Password | Simple shared access with no per-user tracking | Pro or Enterprise | No | No | No |
| Private authentication | Internal site for members of your Mintlify organization | All plans | No | No | No |
Expand All @@ -36,7 +36,7 @@
<Tabs>
<Tab title="Password">
<Info>
Password authentication provides access control only and does **not** support user-specific features like group-based access control or API playground pre-filling.
Password authentication provides access control only and does **not** support user-specific features like group-based access control or API playground prefilling.
</Info>

### Password prerequisites
Expand Down Expand Up @@ -119,7 +119,7 @@
* **Additional authorization parameters** (optional): Additional query parameters to add to the initial authorization request.
* **Token URL**: Your OAuth token exchange endpoint.
* **Info API URL** (optional): Endpoint on your server that Mintlify calls to retrieve user info. Use this field for group-based access control. If omitted, the OAuth flow only verifies identity.
* **Logout URL** (optional): The native logout URL for your OAuth provider. When users log out, Mintlify validates the logout redirect against this configured URL for security. The redirect only succeeds if it exactly matches the configured `logoutUrl`. If you do not configure a logout URL, users redirect to `/login`. Mintlify redirects users with a `GET` request and does not append query parameters, so include any parameters (for example, `returnTo`) directly in the URL.
* **Logout URL** (optional): The native logout URL for your OAuth provider. When users log out, Mintlify validates the logout redirect against this configured URL for security. The redirect only succeeds if it exactly matches the configured `logoutUrl`. If you do not configure a logout URL, users redirect to `/login`. Mintlify redirects users with a `GET` request and does not append query parameters. Include any parameters (for example, `returnTo`) directly in the URL.
* **Redirect URL** (optional): The URL to redirect users to after authentication.
6. Click **Save changes**.

Expand Down Expand Up @@ -480,25 +480,25 @@
</ParamField>

<ParamField path="apiPlaygroundInputs" type="object">
Pre-fills API playground fields with user-specific values. When a user authenticates, these values populate the corresponding input fields in the API playground. Users can override pre-filled values, and their overrides persist in local storage.
Prefills API playground fields with user-specific values. When a user authenticates, these values populate the corresponding input fields in the API playground. Users can override prefilled values, and their overrides persist in local storage.

Check warning on line 483 in deploy/authentication-setup.mdx

View check run for this annotation

Mintlify / Mintlify Validation (mintlify) - vale-spellcheck

deploy/authentication-setup.mdx#L483

Use 'prefill(s|ing|ed)?' instead of 'Prefills'.

Mintlify applies only values that match the current endpoint's security scheme.

<Expandable title="properties">
<ParamField path="header" type="Record<string, unknown>">
Header values to pre-fill, keyed by header name.
Header values to prefill, keyed by header name.
</ParamField>
<ParamField path="query" type="Record<string, unknown>">
Query parameter values to pre-fill, keyed by parameter name.
Query parameter values to prefill, keyed by parameter name.
</ParamField>
<ParamField path="cookie" type="Record<string, unknown>">
Cookie values to pre-fill, keyed by cookie name.
Cookie values to prefill, keyed by cookie name.
</ParamField>
<ParamField path="server" type="Record<string, string>">
Server variable values to pre-fill, keyed by variable name.
Server variable values to prefill, keyed by variable name.
</ParamField>
<ParamField path="path" type="Record<string, unknown>">
Path parameter values to pre-fill, keyed by parameter name.
Path parameter values to prefill, keyed by parameter name.
</ParamField>
</Expandable>
</ParamField>
Expand Down