You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Custom JS is available on the [growth plan](https://mintlify.com/pricing).
7
+
Custom JS is available as an add-on to the [pro plan](https://mintlify.com/pricing).
8
8
</Check>
9
9
10
10
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.
11
11
12
-
## Adding script.js
12
+
## Adding Custom JavaScript
13
13
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.
Copy file name to clipboardExpand all lines: advanced/user-auth/jwt.mdx
+52-6Lines changed: 52 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,24 +9,70 @@ If you don’t have a dashboard, or if you want to keep your dashboard and docs
9
9
10
10
<Steps>
11
11
<Steptitle="Generate a private key">
12
-
Go to your [Mintlify dashboard settings](https://dashboard.mintlify.com/settings/integrations) and generate a private key. Store this key somewhere secure where it can be accessed by your backend.
12
+
Go to your [Mintlify dashboard settings](https://dashboard.mintlify.com/mintlify/mintlify/settings/deployment/user-authentication) and generate a private key. Store this key somewhere secure where it can be accessed by your backend.
13
13
</Step>
14
14
<Steptitle="Create a login flow">
15
15
Create a login flow that does the following:
16
16
- Authenticate the user
17
17
- 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
19
19
- Create a redirect URL back to your docs, including the JWT as the hash
20
20
</Step>
21
21
<Steptitle="Configure your User Auth settings">
22
-
Return to your [Mintlify dashboard settings](https://dashboard.mintlify.com/settings/integrations) and add the login URL to your User Auth settings.
22
+
Return to your [Mintlify dashboard settings](https://dashboard.mintlify.com/mintlify/mintlify/settings/deployment/user-authentication) and add the login URL to your User Auth settings.
23
23
</Step>
24
24
</Steps>
25
25
26
26
## Example
27
27
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).
29
30
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.
31
37
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
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}`.
0 commit comments