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

Function authForHost

packages/plugins/apps/src/git-client/transport.ts:20–27  ·  view source on GitHub ↗
(host: string, token?: string)

Source from the content-addressed store, hash-verified

18}
19
20export function authForHost(host: string, token?: string): AuthRecipe {
21 if (!token) return {};
22 if (host.includes("github.com")) return { authorization: basicAuth("x-access-token", token) };
23 if (host.includes("gitlab.com")) return { authorization: basicAuth("oauth2", token) };
24 if (host.includes("bitbucket.org")) return { authorization: basicAuth("x-token-auth", token) };
25 // generic (Gitea/self-hosted): token as password with arbitrary username
26 return { authorization: basicAuth("git", token) };
27}
28
29function baseHeaders(auth: AuthRecipe): Record<string, string> {
30 const h: Record<string, string> = {

Callers 3

app-source.test.tsFile · 0.90
handFetchFunction · 0.90
handRefsCheckFunction · 0.90

Calls 1

basicAuthFunction · 0.85

Tested by

no test coverage detected