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

Function signInSession

e2e/targets/selfhost.ts:24–44  ·  view source on GitHub ↗
(
  baseUrl: string,
  credentials: { readonly email: string; readonly password: string },
)

Source from the content-addressed store, hash-verified

22// `origin` header is required — Better Auth rejects state-changing requests
23// without it.
24export const signInSession = async (
25 baseUrl: string,
26 credentials: { readonly email: string; readonly password: string },
27): Promise<{
28 readonly cookieHeader: string;
29 readonly cookies: ReadonlyArray<{ readonly name: string; readonly value: string }>;
30}> => {
31 const response = await fetch(new URL("/api/auth/sign-in/email", baseUrl), {
32 method: "POST",
33 headers: { "content-type": "application/json", origin: new URL(baseUrl).origin },
34 body: JSON.stringify(credentials),
35 redirect: "manual",
36 });
37 const pairs = (response.headers.getSetCookie?.() ?? []).map((c) => c.split(";")[0]!.trim());
38 if (pairs.length === 0) throw new Error(`selfhost: sign-in set no cookie (${response.status})`);
39 const cookies = pairs.map((pair) => {
40 const eq = pair.indexOf("=");
41 return { name: pair.slice(0, eq), value: pair.slice(eq + 1) };
42 });
43 return { cookieHeader: pairs.join("; "), cookies };
44};
45
46// Headless MCP OAuth consent. The self-host serving layer forces
47// `prompt=consent` on every MCP authorize (src/auth/force-mcp-consent), so an

Callers 4

createInvitedIdentityFunction · 0.90
selfhostDockerTargetFunction · 0.90
forcedMcpConsentFunction · 0.85
selfhostTargetFunction · 0.85

Calls 1

fetchFunction · 0.50

Tested by 1

createInvitedIdentityFunction · 0.72