MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / createDeviceAuthRequest

Function createDeviceAuthRequest

apps/extension/src/shared/auth.ts:142–157  ·  view source on GitHub ↗
({
  apiBaseUrl,
  fetch,
}: ApiClientOptions)

Source from the content-addressed store, hash-verified

140};
141
142export const createDeviceAuthRequest = async ({
143 apiBaseUrl,
144 fetch,
145}: ApiClientOptions): Promise<DeviceAuthRequest> => {
146 const response = await fetch(`${trimTrailingSlash(apiBaseUrl)}/api/device-auth/codes?app=1`, {
147 headers: { 'Content-Type': 'application/json' },
148 method: 'POST',
149 });
150
151 if (!response.ok) {
152 throw new Error('Failed to start sign in.');
153 }
154
155 const data: unknown = await response.json();
156 return parseDeviceAuthRequest(data);
157};
158
159export const pollDeviceAuthCode = async ({
160 apiBaseUrl,

Callers 2

AppFunction · 0.90
auth.test.tsFile · 0.90

Calls 4

parseDeviceAuthRequestFunction · 0.85
fetchFunction · 0.70
trimTrailingSlashFunction · 0.70
jsonMethod · 0.65

Tested by

no test coverage detected