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

Function connect

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

Source from the content-addressed store, hash-verified

1212 // session subject, which is what the colliding pair needs) against its
1213 // own authorization server, so token provenance is observable.
1214 const connect = (session: typeof sessionA, server: typeof serverA) =>
1215 Effect.gen(function* () {
1216 yield* session.acme.seed();
1217 yield* session.oauth.createClient({
1218 owner: "org",
1219 slug: CLIENT,
1220 authorizationUrl: server.authorizationEndpoint,
1221 tokenUrl: server.tokenEndpoint,
1222 grant: "authorization_code",
1223 clientId: "test-client",
1224 clientSecret: "test-secret",
1225 });
1226 const started = yield* session.oauth.start({
1227 owner: "user",
1228 client: CLIENT,
1229 clientOwner: "org",
1230 name: ConnectionName.make("mine"),
1231 integration: INTEG,
1232 template: TEMPLATE,
1233 });
1234 expect(started.status).toBe("redirect");
1235 if (started.status !== "redirect") return;
1236 const callback = yield* server.completeAuthorizationCodeFlow({
1237 authorizationUrl: started.authorizationUrl,
1238 });
1239 yield* session.oauth.complete({ state: started.state, code: callback.code });
1240 });
1241 yield* connect(sessionA, serverA);
1242 yield* connect(sessionB, serverB);
1243

Callers 1

oauth-flow.test.tsFile · 0.70

Calls 2

completeMethod · 0.80
startMethod · 0.65

Tested by

no test coverage detected