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

Function connect

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

Source from the content-addressed store, hash-verified

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

Callers 1

oauth-flow.test.tsFile · 0.70

Calls 2

completeMethod · 0.80
startMethod · 0.65

Tested by

no test coverage detected