MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / connect

Function connect

packages/core/sdk/src/oauth-flow.test.ts:1334–1360  ·  view source on GitHub ↗
(session: typeof sessionA, server: typeof serverA)

Source from the content-addressed store, hash-verified

1332 // session subject, which is what the colliding pair needs) against its
1333 // own authorization server, so token provenance is observable.
1334 const connect = (session: typeof sessionA, server: typeof serverA) =>
1335 Effect.gen(function* () {
1336 yield* session.acme.seed();
1337 yield* session.oauth.createClient({
1338 owner: "org",
1339 slug: CLIENT,
1340 authorizationUrl: server.authorizationEndpoint,
1341 tokenUrl: server.tokenEndpoint,
1342 grant: "authorization_code",
1343 clientId: "test-client",
1344 clientSecret: "test-secret",
1345 });
1346 const started = yield* session.oauth.start({
1347 owner: "user",
1348 client: CLIENT,
1349 clientOwner: "org",
1350 name: ConnectionName.make("mine"),
1351 integration: INTEG,
1352 template: TEMPLATE,
1353 });
1354 expect(started.status).toBe("redirect");
1355 if (started.status !== "redirect") return;
1356 const callback = yield* server.completeAuthorizationCodeFlow({
1357 authorizationUrl: started.authorizationUrl,
1358 });
1359 yield* session.oauth.complete({ state: started.state, code: callback.code });
1360 });
1361 yield* connect(sessionA, serverA);
1362 yield* connect(sessionB, serverB);
1363

Callers 1

oauth-flow.test.tsFile · 0.70

Calls 2

completeMethod · 0.80
startMethod · 0.65

Tested by

no test coverage detected