Documentation edits made through Mintlify web editor

This commit is contained in:
Riskey
2025-09-09 09:53:27 +08:00
committed by GitHub
parent fd348d56c8
commit 343772062f

View File

@@ -4,7 +4,9 @@ title: "Adding OAuth Support to Your Tool Plugin"
![b0e673ba3e339b31ac36dc3cd004df04787bcaa64bb6d2cac6feb7152b7b515f.png](/images/b0e673ba3e339b31ac36dc3cd004df04787bcaa64bb6d2cac6feb7152b7b515f.png)
This guide teaches you how to build [OAuth](https://oauth.net/2/) support into your tool plugin. OAuth is a better way to authorize tool plugins that need to access user data from third-party services, like Gmail or GitHub. Instead of requiring the user to manually enter API keys, OAuth lets the tool act on behalf of the user with their explicit consent.
This guide teaches you how to build [OAuth](https://oauth.net/2/) support into your tool plugin.
OAuth is a better way to authorize tool plugins that need to access user data from third-party services, like Gmail or GitHub. Instead of requiring the user to manually enter API keys, OAuth lets the tool act on behalf of the user with their explicit consent.
## Background
@@ -27,16 +29,16 @@ Dify instance's admin / developer first need to register an OAuth app at the thi
2. Enable the required APIs (e.g., Gmail API)
</Accordion>
<Accordion title="Configure OAuth Consent Screen:">
1. Navigate to "APIs & Services" → "OAuth consent screen"
2. Choose "External" user type for public plugins
1. Navigate to **APIs & Services** \> **OAuth consent screen**
2. Choose **External** user type for public plugins
3. Fill in application name, user support email, and developer contact
4. Add authorized domains if needed
5. For testing: Add test users in the "Test users" section
5. For testing: Add test users in the **Test users** section
</Accordion>
<Accordion title="Create OAuth 2.0 Credentials">
1. Go to "APIs & Services" → "Credentials"
2. Click "Create Credentials" → "OAuth 2.0 Client IDs"
3. Choose "Web application" type
1. Go to **APIs & Services** \> **Credentials**
2. Click **Create Credentials** \> **OAuth 2.0 Client IDs**
3. Choose **Web application** type
4. A`client_id` and a`client_secret` will be generated. Save these as the credentials.
</Accordion>
<Accordion title="Enter Credentials in Dify">
@@ -68,7 +70,7 @@ Dify instance's admin / developer first need to register an OAuth app at the thi
https://{your-dify-domain}/console/api/oauth/plugin/{plugin-id}/{provider-name}/{tool-name}/callback
```
For self-hosted Dify, the {your-dify-domain} should be consistent with the `CONSOLE_WEB_URL`.
For self-hosted Dify, the `your-dify-domain` should be consistent with the `CONSOLE_WEB_URL`.
</Info>
</Accordion>
</AccordionGroup>