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

Function signInSession

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

Source from the content-addressed store, hash-verified

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

Callers 4

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

Calls 1

fetchFunction · 0.50

Tested by

no test coverage detected