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 (2 of 8 files). Show all

Unified · Split

2 files
  1. apps/cloud/src/engine/execution-stack.ts +20 −1
  2. apps/cloud/src/env-augment.d.ts +2 −0
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, () => ({
apps/cloud/src/env-augment.d.ts+2−0
@@ -67,6 +67,8 @@ declare global { · 66 unmodified lines
6767 FIRST_PARTY_GITHUB_TOKEN_URL?: string;
6868 FIRST_PARTY_GOOGLE_CLIENT_ID?: string;
6969 FIRST_PARTY_GOOGLE_CLIENT_SECRET?: string;
70+ FIRST_PARTY_SLACK_CLIENT_ID?: string;
71+ FIRST_PARTY_SLACK_CLIENT_SECRET?: string;
7072
7173 // Billing
7274 AUTUMN_SECRET_KEY?: string;