( config: FirstPartyOAuthClientConfig, )
| 611 | * client_credentials mints machine tokens under the OPERATOR's app identity, |
| 612 | * which must never be shared across tenants. */ |
| 613 | export 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 | |
| 641 | export const makeOAuthService = (deps: OAuthServiceDeps): OAuthService => { |
| 642 | const httpClientLayer = deps.httpClientLayer ?? FetchHttpClient.layer; |
no test coverage detected