mirror of
https://github.com/langgenius/dify-docs.git
synced 2026-03-27 13:28:32 +07:00
Documentation edits made through Mintlify web editor
This commit is contained in:
@@ -4,7 +4,9 @@ title: "Adding OAuth Support to Your Tool Plugin"
|
||||
|
||||

|
||||
|
||||
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>
|
||||
|
||||
Reference in New Issue
Block a user