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
Copy file name to clipboardExpand all lines: authentication-personalization/authentication-setup.mdx
+35-28Lines changed: 35 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,11 +17,11 @@ Authentication requires users to log in before accessing your documentation. Thi
17
17
Select the handshake method that you want to configure.
18
18
19
19
<Tabs>
20
-
<Tabtitle="JWT">
20
+
<Tabtitle="JWT">
21
21
### Prerequisites
22
22
23
-
* An authentication system that can generate and sign JWTs.
24
-
* A backend service that can create redirect URLs.
23
+
* An authentication system that can generate and sign JWTs.
24
+
* A backend service that can create redirect URLs.
25
25
26
26
### Implementation
27
27
@@ -44,6 +44,7 @@ Select the handshake method that you want to configure.
44
44
</Steps>
45
45
46
46
### Example
47
+
47
48
Your documentation is hosted at `docs.foo.com` with an existing authentication system at `foo.com`. You want to extend your login flow to grant access to the docs.
48
49
49
50
To do this, create a login endpoint at `https://foo.com/docs-login` that extends your existing authentication.
@@ -117,54 +118,60 @@ When an unauthenticated user tries to access a protected page, their intended de
117
118
2. Redirect to your login URL with a redirect query parameter: `https://foo.com/docs-login?redirect=%2Fquickstart`.
118
119
3. After authentication, redirect to `https://docs.foo.com/login/jwt-callback?redirect=%2Fquickstart#{SIGNED_JWT}`.
119
120
4. User lands in their original destination.
120
-
</Tab>
121
+
</Tab>
121
122
<Tabtitle="OAuth 2.0">
122
123
### Prerequisites
123
124
124
-
- You have an existing OAuth server that supports the Authorization Code flow.
125
-
- You can create a new API endpoint that can be accessed by the returned OAuth access token.
125
+
* An OAuth server that supports the Authorization Code Flow.
126
+
* Ability to create an API endpoint accessible by OAuth access tokens (optional, to enable personalization features).
126
127
127
128
### Implementation
128
129
129
130
<Steps>
130
-
<Steptitle="Configure your Authentication settings">
131
-
Go to your [Mintlify authentication settings](https://dashboard.mintlify.com/products/authentication), select the OAuth option, and fill out the required fields:
132
-
133
-
-**Authorization URL**: The base URL for the authorization request, to which we will add the appropriate query parameters.
134
-
-**Client ID**: An ID for the OAuth 2.0 client to be used.
135
-
-**Scopes**: An array of scopes that will be requested. TODO: clarify why there could be multiple
136
-
-**Token URL**: The base URL for the token exchange request.
137
-
-**Info API URL** (optional): The endpoint that will be hit to retrieve user info. If omitted, the OAuth flow will only be used to verify identity, and the user info will be empty.
131
+
<Steptitle="Configure your OAuth settings.">
132
+
1. In your dashboard, go to [Authentication](https://dashboard.mintlify.com/settings/deployment/authentication).
133
+
2. Select **Full Authentication** or **Partial Authentication**.
134
+
3. Select **OAuth** and configure these fields:
135
+
***Authorization URL**: Your OAuth endpoint.
136
+
***Client ID**: Your OAuth 2.0 client identifier.
137
+
***Client Secret**: Your OAuth 2.0 client secret.
138
+
***Scopes**: Permissions to request. Use multiple scopes if you need different access levels.
139
+
***Token URL**: Your OAuth token exchange endpoint.
140
+
***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.
141
+
4. Select **Save changes**.
138
142
</Step>
139
-
<Steptitle="Configure your OAuth client">
140
-
Copy the Redirect URL listed in the [Mintlify authentication settings](https://dashboard.mintlify.com/products/authentication) and add it as an authorized redirect URL for your OAuth server.
143
+
<Steptitle="Configure your OAuth server.">
144
+
1. Copy the **Redirect URL** from your [authentication settings](https://dashboard.mintlify.com/settings/deployment/authentication).
145
+
2. Add the redirect URL as an authorized redirect URL for your OAuth server.
141
146
</Step>
142
-
<Steptitle="Create your Info API (Optional)">
143
-
If you want to take advantage of authentication's customization features, you'll need to create an endpoint to retrieve info about your users.
144
-
Create an API endpoint that can be accessed with an OAuth access token, and responds with a JSON payload following the [User](../sending-data) format.
145
-
146
-
Return to your [Mintlify authentication settings](https://dashboard.mintlify.com/products/authentication) and add the Info API URL
147
-
to your OAuth configuration.
147
+
<Steptitle="Create your user info endpoint (optional).">
148
+
To enable personalization features, create an API endpoint that:
149
+
* Accepts OAuth access tokens for authentication.
150
+
* Returns user data in the `User` format. See [Sending Data](/authentication-personalization/sending-data) for more information.
151
+
152
+
Add this endpoint URL to the **Info API URL** field in your [authentication settings](https://dashboard.mintlify.com/settings/deployment/authentication).
148
153
</Step>
149
154
</Steps>
150
155
151
156
## Example
152
157
153
-
I have an existing OAuth server that supports the Authorization Code flow. I want to set up authentication for my docs hosted at `foo.com/docs`.
158
+
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.
154
159
155
-
To set up authentication with Mintlify, I create an endpoint `api.foo.com/docs/user-info` which requires an OAuth access token with the `docs-user-info` scope, and responds with the user's custom data according to Mintlify’s specification.
156
-
157
-
I then go to the dashboard settings, navigate to the Authentication settings, select OAuth, and enter the relevant values for the OAuth flow and Info API endpoint:
160
+
To set up authentication with Mintlify, configure your OAuth server details in your dashboard:
-**Info API URL**: `https://api.foo.com/docs/user-info`
163
166
164
-
Finally, I copy the Redirect URL displayed in the dashboard settings and add it as an authorized redirect URL in my OAuth client configuration settings.
165
167
168
+
create an endpoint `api.foo.com/docs/user-info` which requires an OAuth access token with the `docs-user-info` scope, and responds with the user's custom data according to Mintlify’s specification.
166
169
167
-
</Tab>
170
+
I then go to the dashboard settings, navigate to the Authentication settings, select OAuth, and enter the relevant values for the OAuth flow and Info API endpoint:
171
+
172
+
173
+
Finally, I copy the Redirect URL displayed in the dashboard settings and add it as an authorized redirect URL in my OAuth client configuration settings.
0 commit comments