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

Function connect

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

Source from the content-addressed store, hash-verified

1087 // session subject, which is what the colliding pair needs) against its
1088 // own authorization server, so token provenance is observable.
1089 const connect = (session: typeof sessionA, server: typeof serverA) =>
1090 Effect.gen(function* () {
1091 yield* session.acme.seed();
1092 yield* session.oauth.createClient({
1093 owner: "org",
1094 slug: CLIENT,
1095 authorizationUrl: server.authorizationEndpoint,
1096 tokenUrl: server.tokenEndpoint,
1097 grant: "authorization_code",
1098 clientId: "test-client",
1099 clientSecret: "test-secret",
1100 });
1101 const started = yield* session.oauth.start({
1102 owner: "user",
1103 client: CLIENT,
1104 clientOwner: "org",
1105 name: ConnectionName.make("mine"),
1106 integration: INTEG,
1107 template: TEMPLATE,
1108 });
1109 expect(started.status).toBe("redirect");
1110 if (started.status !== "redirect") return;
1111 const callback = yield* server.completeAuthorizationCodeFlow({
1112 authorizationUrl: started.authorizationUrl,
1113 });
1114 yield* session.oauth.complete({ state: started.state, code: callback.code });
1115 });
1116 yield* connect(sessionA, serverA);
1117 yield* connect(sessionB, serverB);
1118

Callers 1

oauth-flow.test.tsFile · 0.70

Calls 2

completeMethod · 0.80
startMethod · 0.65

Tested by

no test coverage detected