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

Function loadedFirstPartyClient

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

Source from the content-addressed store, hash-verified

678 * client_credentials mints machine tokens under the OPERATOR's app identity,
679 * which must never be shared across tenants. */
680export const loadedFirstPartyClient = (
681 config: FirstPartyOAuthClientConfig,
682): {
683 readonly slug: string;
684 readonly authorizationUrl: string;
685 readonly tokenUrl: string;
686 readonly grant: OAuthGrant;
687 readonly clientId: string;
688 readonly clientSecret: string;
689 readonly resource: string | null;
690 readonly tokenEndpointAuthMethod?: TokenEndpointAuthMethod;
691 readonly tokenRequestFormat?: "form" | "json";
692} => ({
693 slug: String(firstPartyOAuthClientSlug(config.name)),
694 authorizationUrl: config.authorizationUrl,
695 tokenUrl: config.tokenUrl,
696 grant: "authorization_code",
697 clientId: config.clientId,
698 clientSecret: config.clientSecret,
699 resource: config.resource ?? null,
700 ...(config.tokenEndpointAuthMethod === undefined
701 ? {}
702 : { tokenEndpointAuthMethod: config.tokenEndpointAuthMethod }),
703 ...(config.tokenRequestFormat === undefined
704 ? {}
705 : { tokenRequestFormat: config.tokenRequestFormat }),
706});
707
708export const makeOAuthService = (deps: OAuthServiceDeps): OAuthService => {
709 const httpClientLayer = deps.httpClientLayer ?? FetchHttpClient.layer;

Callers 1

loadClientFunction · 0.85

Calls 1

Tested by

no test coverage detected