History

Add Slack first-party OAuth (#1640)

Rhys Sullivan committed 2 months ago

Commit 63ea0281 parent f64028a8 files · +141 −49Browse files

Showing the changes to apps/cloud/src/engine (1 of 8 files). Show all

Unified · Split

apps/cloud/src/engine/execution-stack.ts+20−1
@@ -43,8 +43,13 @@ import { · 42 unmodified lines
4343 collectTables,
4444 } from "@executor-js/api/server";
4545 import { googleCatalogOAuthScopesForPreset } from "@executor-js/plugin-openapi/providers/google";
46+import { slackMcpUserScopes } from "@executor-js/react/lib/slack-mcp-oauth";
4647 import { makeDynamicWorkerExecutor } from "@executor-js/runtime-dynamic-worker";
47−import type { AnyPlugin, FirstPartyOAuthClientConfig } from "@executor-js/sdk";
48+import {
49+ IntegrationSlug,
50+ type AnyPlugin,
51+ type FirstPartyOAuthClientConfig,
52+} from "@executor-js/sdk";
4853
4954 import executorConfig from "../../executor.config";
5055 import { DbService } from "../db/db";
@@ -136,6 +141,20 @@ const cloudFirstPartyOAuthClients = (): readonly FirstPartyOAuthClientConfig[] = · 85 unmodified lines
136141 },
137142 ]
138143 : []),
144+ ...(env.FIRST_PARTY_SLACK_CLIENT_ID && env.FIRST_PARTY_SLACK_CLIENT_SECRET
145+ ? [
146+ {
147+ name: "slack",
148+ authorizationUrl: "https://slack.com/oauth/v2_user/authorize",
149+ tokenUrl: "https://slack.com/api/oauth.v2.user.access",
150+ resource: "https://mcp.slack.com",
151+ clientId: env.FIRST_PARTY_SLACK_CLIENT_ID,
152+ clientSecret: env.FIRST_PARTY_SLACK_CLIENT_SECRET,
153+ integrations: [IntegrationSlug.make("slack")],
154+ allowedScopes: slackMcpUserScopes,
155+ },
156+ ]
157+ : []),
139158 ];
140159
141160 export const CloudHostConfig: Layer.Layer<HostConfig> = Layer.sync(HostConfig, () => ({