MCPcopy
hub / github.com/ericc-ch/copilot-api / getDeviceCode

Function getDeviceCode

src/services/github/get-device-code.ts:9–22  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7import { HTTPError } from "~/lib/error"
8
9export async function getDeviceCode(): Promise<DeviceCodeResponse> {
10 const response = await fetch(`${GITHUB_BASE_URL}/login/device/code`, {
11 method: "POST",
12 headers: standardHeaders(),
13 body: JSON.stringify({
14 client_id: GITHUB_CLIENT_ID,
15 scope: GITHUB_APP_SCOPES,
16 }),
17 })
18
19 if (!response.ok) throw new HTTPError("Failed to get device code", response)
20
21 return (await response.json()) as DeviceCodeResponse
22}
23
24export interface DeviceCodeResponse {
25 device_code: string

Callers 1

setupGitHubTokenFunction · 0.90

Calls 1

standardHeadersFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…