Skip to content

Commit 159a51d

Browse files
committed
temp
1 parent b841778 commit 159a51d

9 files changed

+121
-77
lines changed

docs/quick-starts/third-party/oidc/README.mdx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ sidebar_custom_props:
66
logoFilename: 'oidc.svg'
77
---
88

9+
import QuickStartsReference from './_quick-starts-reference.md';
10+
911
# Integrate third-party app with OIDC / OAuth
1012

1113
Use Logto as your identity provider (IdP) to integrate third-party apps via OpenID Connect (OIDC) or OAuth 2.0 protocol.
@@ -35,9 +37,12 @@ In order to set up Logto as an IdP for your third-party applications, you need t
3537
3. Retrieve the **authorization endpoint** and **token endpoint** from Logto application details page and provide them to your service provider.
3638

3739
- If your service provider supports OIDC discovery, you can simply copy the **discovery endpoint** from Logto application details page and provide it to your service provider. The service provider will be able to retrieve all the up to date OIDC authentication information from the discovery endpoint automatically.
38-
3940
- Otherwise, click on the **Show endpoint details** button to view all the OIDC authentication endpoints.
4041

42+
---
43+
44+
<QuickStartsReference />
45+
4146
## Manage your third-party applications \{#manage-your-third-party-applications}
4247

4348
All third-party applications will be catalogued on the **Applications** page, specifically under the **Third-party apps** tab. This arrangement distinguishes them from first-party applications for you, ensuring easy management.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Under the hood, a third-party app is just a standard OAuth 2.0 / OIDC client. This means you (or the third-party developer) can use any OAuth 2.0 / OIDC library or framework to integrate with Logto.
2+
3+
If you're not familiar with OAuth 2.0 or OIDC, you can start by following one of our “Traditional web” quick start guides.
4+
5+
A few things to keep in mind:
6+
7+
1. Logto currently requires third-party apps to be “Traditional web” apps. In other words, the app needs a backend server (or backend-for-frontend) to securely store the client secret.
8+
2. Most our quick start guides are written for first-party apps, but you can still use them as a reference for third-party app integration.
9+
3. The main difference is that third-party apps will show a consent screen, asking users for explicit permission to access their data.
10+
11+
You can find more information in our [quick start guides](https://docs.logto.io/quick-starts).

docs/use-cases/ai/fragments/_mcp-introduction.mdx

Lines changed: 0 additions & 14 deletions
This file was deleted.

docs/use-cases/ai/fragments/_mcp-prerequisites.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
### Understanding the architecture
77

88
- **MCP server**: The server that exposes tools and resources to MCP clients.
9-
- **MCP Inspector**: A MCP client used to initiate the authentication flow and test the integration.
9+
- **MCP client**: A client used to initiate the authentication flow and test the integration. {props.clientDescription && <b>{props.clientDescription}</b>}
1010
- **Logto**: Serves as the OpenID Connect provider (authorization server) and manages user identities.
1111

1212
A non-normative sequence diagram illustrates the overall flow of the process:
1313

1414
```mermaid
1515
sequenceDiagram
16-
participant Client as MCP Inspector
16+
participant Client as Client
1717
participant Server as MCP Server
1818
participant Logto
1919

docs/use-cases/ai/fragments/_mcp-sample-code.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import Tabs from '@theme/Tabs';
44
<Tabs groupId="sdk">
55
<TabItem value="python" label="Python">
66

7-
The full code can be found in the [mcp-auth/python](https://github.com/mcp-auth/python) repository.
7+
The full MCP server code can be found in the [mcp-auth/python](https://github.com/mcp-auth/python) repository.
88

99
</TabItem>
1010
<TabItem value="node" label="Node.js">
1111

12-
The full code can be found in the [mcp-auth/js](https://github.com/mcp-auth/js) repository.
12+
The full MCP server code can be found in the [mcp-auth/js](https://github.com/mcp-auth/js) repository.
1313

1414
</TabItem>
1515
</Tabs>

docs/use-cases/ai/fragments/_mcp-test-integration.mdx

Lines changed: 0 additions & 41 deletions
This file was deleted.

docs/use-cases/ai/mcp-server-add-auth.mdx

Lines changed: 54 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,28 @@ sidebar_position: 1
33
sidebar_label: Enable auth for MCP-powered apps
44
---
55

6-
import Introduction from './fragments/_mcp-introduction.mdx';
76
import Prerequisites from './fragments/_mcp-prerequisites.mdx';
87
import SampleCode from './fragments/_mcp-sample-code.mdx';
98
import SetUpServer from './fragments/_mcp-set-up-server.mdx';
10-
import TestIntegration from './fragments/_mcp-test-integration.mdx';
119

1210
# Enable auth for your MCP-powered apps with Logto
1311

14-
<Introduction />
12+
This guide walks you through integrating Logto with your MCP server using [mcp-auth](https://mcp-auth.dev), allowing you to authenticate users and securely retrieve their identity information using the standard OpenID Connect flow.
1513

16-
<Prerequisites />
14+
You'll learn how to:
15+
16+
- Configure Logto as the authorization server for your MCP server.
17+
- Set up a “whoami” tool to return the current user's identity claims.
18+
- Test the flow with the MCP Inspector.
19+
20+
After this tutorial, your MCP server will:
21+
22+
- Authenticate users in your Logto tenant.
23+
- Return identity claims (`sub`, `username`, `name`, `email`, etc.) for the "whoami" tool invocation.
24+
25+
Once the integration is complete, you can replace the MCP Inspector with your own MCP client, such as a web app, to access the tools and resources exposed by your MCP server.
26+
27+
<Prerequisites clientDescription="We'll use the MCP Inspector as the client in this guide." />
1728

1829
## Set up app in Logto
1930

@@ -25,6 +36,44 @@ import TestIntegration from './fragments/_mcp-test-integration.mdx';
2536

2637
<SetUpServer />
2738

28-
<TestIntegration />
39+
## Test the integration
40+
41+
1. Start the MCP server
42+
2. Start the MCP Inspector.
43+
44+
Due to the limit of the current MCP Inspector implementation, we need to use the forked version from mcp-auth:
45+
46+
```bash
47+
git clone https://github.com/mcp-auth/inspector.git
48+
cd inspector
49+
npm install
50+
npm run dev
51+
```
52+
53+
Then, open the URL shown in the terminal.
54+
55+
3. In the MCP Inspector:
56+
57+
- **Transport Type**: `SSE`
58+
- **URL**: `http://localhost:3001/sse`
59+
- **OAuth Client ID**: Paste your Logto App ID
60+
- **Auth Params**: `{"scope": "openid profile email"}`
61+
- **Redirect URI**: This URL should be auto-populated. Copy it.
62+
63+
4. Find the application you created earlier in the Logto Console, open the details page, and paste the redirect URI into the **Settings** / **Redirect URIs** section. Save the changes.
64+
5. Back in the MCP Inspector, click **Connect**. This should redirect you to the Logto sign-in experience.
65+
66+
After completing sign-in, you should be redirected back to the MCP Inspector. Go to **Tools** -> **List Tools** -> **whoami** -> **Run Tool**.
67+
68+
You should see user claims, such as:
69+
70+
```json
71+
{
72+
"sub": "user_XXXX",
73+
"username": "alice",
74+
"name": "Alice Smith",
75+
"email": "alice@example.com"
76+
}
77+
```
2978

3079
<SampleCode />

docs/use-cases/ai/mcp-server-enable-ai-agent-and-third-party-access.mdx

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,69 @@ sidebar_position: 2
33
sidebar_label: Enable AI agent and third-party app access to MCP server
44
---
55

6-
import Introduction from './fragments/_mcp-introduction.mdx';
6+
import QuickStartsReference from '../../quick-starts/third-party/oidc/_quick-starts-reference.md';
7+
8+
import thirdPartyAppPermissions from './assets/third-party-app-permissions.png';
79
import Prerequisites from './fragments/_mcp-prerequisites.mdx';
810
import SampleCode from './fragments/_mcp-sample-code.mdx';
911
import SetUpServer from './fragments/_mcp-set-up-server.mdx';
10-
import TestIntegration from './fragments/_mcp-test-integration.mdx';
1112

1213
# Enable AI agent and third-party app access to your MCP server
1314

1415
:::note
15-
The main difference between this guide and the previous one is that this guide will treat the MCP Inspector as a third-party app in Logto. If you want to integrate your MCP server with your own app, please refer to the [Enable auth for your MCP-powered apps with Logto](./mcp-server-add-auth) guide.
16+
If you want to integrate your MCP server with your own app, please refer to the [Enable auth for your MCP-powered apps with Logto](./mcp-server-add-auth) guide.
1617
:::
1718

18-
<Introduction isThirdPartyApp />
19+
This guide walks you through integrating Logto with your MCP server using [mcp-auth](https://mcp-auth.dev), allowing you to authenticate users and securely retrieve their identity information using the standard OpenID Connect flow.
20+
21+
You'll learn how to:
22+
23+
- Configure Logto as the authorization server for your MCP server.
24+
- Set up a “whoami” tool to return the current user's identity claims.
25+
- Test the flow with an AI agent or third-party app.
26+
27+
After this tutorial, your MCP server will:
28+
29+
- Authenticate users in your Logto tenant.
30+
- Return identity claims (`sub`, `username`, `name`, `email`, etc.) for the "whoami" tool invocation.
31+
32+
<Prerequisites clientDescription="The AI agent or third-party app will be used as the client in this guide." />
33+
34+
## Set up AI agent or third-party app
1935

20-
<Prerequisites />
36+
To enable the AI agent or third-party app (client) to access your MCP server, you need to set up the following:
37+
38+
1. The client should be able to make MCP requests to invoke the tools exposed by the MCP server.
39+
2. The client should be able to handle the 401 Unauthorized response. See [Authorization Flow Steps](https://modelcontextprotocol.io/specification/2025-03-26/basic/authorization#2-5-authorization-flow-steps) for more details.
2140

2241
## Set up app in Logto
2342

43+
### Self-registered flow
44+
45+
### Manually create a third-party app
46+
47+
You can manually create a third-party app in Logto Console for testing purposes or ad-hoc integrations. This is useful when you want to quickly test the integration without implementing a full client-registration flow.
48+
2449
1. Sign in to your Logto Console.
2550
2. Go <CloudLink to="/applications">**Applications**</CloudLink> → **Create application****Third-party app** -> **OIDC**.
2651
3. Fill in the app name and other required fields, then click **Create application**.
2752
4. Click **Permissions** tab, in the **User** section, click "Add".
2853
5. In the opened dialog -> **User data** -> select **`profile`**, **`email`** permissions, then click **Save**.
29-
6. Go to **Settings** tab, save and copy the **App ID** and **Issuer endpoint**.
54+
6. In the third-party app, configure scopes to request `openid profile email` permissions.
55+
7. Configure the **redirect URI** of your third-party application accordingly. Remember to update the redirect URI in Logto as well.
56+
57+
<img
58+
src={thirdPartyAppPermissions}
59+
alt="Third-party app permissions"
60+
style={{ maxWidth: '800px', width: '100%' }}
61+
/>
62+
63+
---
3064

31-
![Third-party app permissions](./assets/third-party-app-permissions.png)
65+
<QuickStartsReference />
3266

3367
<SetUpServer />
3468

35-
<TestIntegration isThirdPartyApp />
69+
## Test the integration
3670

3771
<SampleCode />

docusaurus-common.config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,14 @@ export const createCommonThemeConfig = (site: Site) => {
132132
label: 'Integrations',
133133
},
134134
{
135-
to: buildUrl('/use-cases', 'main'),
135+
to: new URL('https://openapi.logto.io', mainSiteUrl).href,
136136
position: 'left',
137-
label: 'Use cases',
137+
label: 'API',
138138
},
139139
{
140-
to: new URL('https://openapi.logto.io', mainSiteUrl).href,
140+
to: buildUrl('/use-cases', 'main'),
141141
position: 'left',
142-
label: 'API',
142+
label: 'Use cases',
143143
},
144144
],
145145
},

0 commit comments

Comments
 (0)