MCPcopy Index your code
hub / github.com/langgenius/dify / requestCode

Method requestCode

cli/src/api/oauth-device.ts:71–90  ·  view source on GitHub ↗
(req: CodeRequest)

Source from the content-addressed store, hash-verified

69 }
70
71 async requestCode(req: CodeRequest): Promise<CodeResponse> {
72 if (req.device_label === '') {
73 throw new BaseError({
74 code: ErrorCode.UsageMissingArg,
75 message: 'device_label is required',
76 })
77 }
78 const body = { client_id: req.client_id ?? DEFAULT_CLIENT_ID, device_label: req.device_label }
79 const res = await this.http.fetch('oauth/device/code', { method: 'POST', json: body })
80 if (res.status === 404)
81 throw versionSkew()
82 if (!res.ok) {
83 throw new HttpClientError({
84 code: ErrorCode.Server4xxOther,
85 message: `device/code: HTTP ${res.status}`,
86 httpStatus: res.status,
87 })
88 }
89 return await res.json() as CodeResponse
90 }
91
92 async pollOnce(req: PollRequest): Promise<PollResult> {
93 if (req.device_code === '') {

Callers 2

runLoginFunction · 0.80

Calls 3

versionSkewFunction · 0.85
fetchMethod · 0.45
jsonMethod · 0.45

Tested by

no test coverage detected