Authentication methods are available on Growth and Enterprise plans.
Configuring authentication
Select the handshake method that you want to configure.- JWT
- OAuth 2.0
- Mintlify Dashboard
- Password
Prerequisites
- An authentication 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 Full Authentication or Partial Authentication.
- 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 authentication into your login flow.
Modify your existing login flow to include these steps after user authentication:
- Create a JWT containing the authenticated user’s info in the
Userformat. See Sending Data for more information. - Sign the JWT with your secret key, using the EdDSA algorithm.
- Create a redirect URL back to the
/login/jwt-callbackpath of your docs, including the JWT as the hash.
Example
Your documentation is hosted atdocs.foo.com with an existing authentication system at foo.com. You want to extend your login flow to grant access to the docs while keeping your docs separate from your dashboard (or you don’t have a dashboard).Create a login endpoint at https://foo.com/docs-login that extends your existing authentication.After verifying user credentials:- Generate a JWT with user data in Mintlify’s format.
- Sign the JWT and redirect to
https://docs.foo.com/login/jwt-callback#{SIGNED_JWT}.
Redirecting unauthenticated users
When an unauthenticated user tries to access a protected page, their intended destination is preserved in the redirect to your login URL:- User attempts to visit a protected page:
https://docs.foo.com/quickstart. - Redirect to your login URL with a redirect query parameter:
https://foo.com/docs-login?redirect=%2Fquickstart. - After authentication, redirect to
https://docs.foo.com/login/jwt-callback?redirect=%2Fquickstart#{SIGNED_JWT}. - User lands in their original destination.