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

Function loadedFirstPartyClient

packages/core/sdk/src/oauth-service.ts:613–639  ·  view source on GitHub ↗
(
  config: FirstPartyOAuthClientConfig,
)

Source from the content-addressed store, hash-verified

611 * client_credentials mints machine tokens under the OPERATOR's app identity,
612 * which must never be shared across tenants. */
613export const loadedFirstPartyClient = (
614 config: FirstPartyOAuthClientConfig,
615): {
616 readonly slug: string;
617 readonly authorizationUrl: string;
618 readonly tokenUrl: string;
619 readonly grant: OAuthGrant;
620 readonly clientId: string;
621 readonly clientSecret: string;
622 readonly resource: string | null;
623 readonly tokenEndpointAuthMethod?: "body" | "basic";
624 readonly tokenRequestFormat?: "form" | "json";
625} => ({
626 slug: String(firstPartyOAuthClientSlug(config.name)),
627 authorizationUrl: config.authorizationUrl,
628 tokenUrl: config.tokenUrl,
629 grant: "authorization_code",
630 clientId: config.clientId,
631 clientSecret: config.clientSecret,
632 resource: config.resource ?? null,
633 ...(config.tokenEndpointAuthMethod === undefined
634 ? {}
635 : { tokenEndpointAuthMethod: config.tokenEndpointAuthMethod }),
636 ...(config.tokenRequestFormat === undefined
637 ? {}
638 : { tokenRequestFormat: config.tokenRequestFormat }),
639});
640
641export const makeOAuthService = (deps: OAuthServiceDeps): OAuthService => {
642 const httpClientLayer = deps.httpClientLayer ?? FetchHttpClient.layer;

Callers 1

loadClientFunction · 0.85

Calls 1

Tested by

no test coverage detected