Skip to content

Commit f9ff80a

Browse files
committed
add OAuth info
1 parent 2d25e49 commit f9ff80a

File tree

1 file changed

+35
-28
lines changed

1 file changed

+35
-28
lines changed

authentication-personalization/authentication-setup.mdx

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ Authentication requires users to log in before accessing your documentation. Thi
1717
Select the handshake method that you want to configure.
1818

1919
<Tabs>
20-
<Tab title="JWT">
20+
<Tab title="JWT">
2121
### Prerequisites
2222

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.
2525

2626
### Implementation
2727

@@ -44,6 +44,7 @@ Select the handshake method that you want to configure.
4444
</Steps>
4545

4646
### Example
47+
4748
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.
4849

4950
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
117118
2. Redirect to your login URL with a redirect query parameter: `https://foo.com/docs-login?redirect=%2Fquickstart`.
118119
3. After authentication, redirect to `https://docs.foo.com/login/jwt-callback?redirect=%2Fquickstart#{SIGNED_JWT}`.
119120
4. User lands in their original destination.
120-
</Tab>
121+
</Tab>
121122
<Tab title="OAuth 2.0">
122123
### Prerequisites
123124

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).
126127

127128
### Implementation
128129

129130
<Steps>
130-
<Step title="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+
<Step title="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**.
138142
</Step>
139-
<Step title="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+
<Step title="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.
141146
</Step>
142-
<Step title="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+
<Step title="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).
148153
</Step>
149154
</Steps>
150155

151156
## Example
152157

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.
154159

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:
158161
- **Authorization URL**: `https://auth.foo.com/authorization`
159162
- **Client ID**: `ydybo4SD8PR73vzWWd6S0ObH`
160163
- **Scopes**: `['docs-user-info']`
161164
- **Token URL**: `https://auth.foo.com/exchange`
162165
- **Info API URL**: `https://api.foo.com/docs/user-info`
163166

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.
165167

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.
166169

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.
174+
</Tab>
168175
<Tab title="Mintlify Dashboard">
169176
### Prerequisites
170177

0 commit comments

Comments
 (0)