Configuring personalization
Select the handshake method that you want to configure.- JWT
- OAuth 2.0
Prerequisites
- A login system that can generate and sign JWTs.
- A backend service that can create redirect URLs.
Implementation
1
Generate a private key.
- In your dashboard, go to Authentication.
- Select Personalization.
- Select JWT.
- Enter the URL of your existing login flow and select Save changes.
- Select Generate new key.
- Store your key securely where it can be accessed by your backend.
2
Integrate Mintlify personalization into your login flow.
Modify your existing login flow to include these steps after user login:
- Create a JWT containing the logged in user’s info in the
Userformat. See Sending Data for more information. - Sign the JWT with the secret key, using the ES256 algorithm.
- Create a redirect URL back to your docs, including the JWT as the hash.
Example
Your documentation is hosted atdocs.foo.com. You want your docs to be separate from your dashboard (or you don’t have a dashboard) and enable personalization.Generate a JWT secret. Then create a login endpoint at https://foo.com/docs-login that initiates a login flow to your documentation.After verifying user credentials:- Generate a JWT with user data in Mintlify’s format.
- Sign the JWT and redirect to
https://docs.foo.com#{SIGNED_JWT}.
Preserving page anchors
To redirect users to specific sections after login, use this URL format:https://docs.foo.com/page#jwt={SIGNED_JWT}&anchor={ANCHOR}.Example:- Original URL:
https://docs.foo.com/quickstart#step-one - Redirect URL:
https://docs.foo.com/quickstart#jwt={SIGNED_JWT}&anchor=step-one