MCPcopy Create free account
hub / github.com/bytebase/bytebase / login

Method login

frontend/tests/e2e/framework/api-client.ts:58–71  ·  view source on GitHub ↗
(email: string, password: string)

Source from the content-addressed store, hash-verified

56 // on 401: request() retries via login() on 401, which would loop forever if
57 // credentials were invalid.
58 async login(email: string, password: string): Promise<string> {
59 const resp = await fetch(`${this.baseURL}/v1/auth/login`, {
60 method: "POST",
61 headers: { "Content-Type": "application/json" },
62 body: JSON.stringify({ email, password }),
63 });
64 if (!resp.ok) {
65 throw new Error(`API POST /v1/auth/login failed (${resp.status}): ${await resp.text()}`);
66 }
67 const { token } = (await resp.json()) as { token: string };
68 this.token = token;
69 this.credentials = { email, password };
70 return token;
71 }
72
73 // Signup creates the first user on a fresh server. The first user becomes
74 // workspace admin. Signup always sets cookies (no body token), so callers

Callers 15

requestMethod · 0.95
asUserMethod · 0.95
startServerFunction · 0.95
createAuthSliceFunction · 0.80
triggerAuthCallbackFunction · 0.80
trySigninFunction · 0.80
trySigninFunction · 0.80
challengeFunction · 0.80
onConfirmFunction · 0.80
setup-project.tsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected