MCPcopy
hub / github.com/coder/mux / parseGithubAccessTokenResponse

Function parseGithubAccessTokenResponse

src/node/services/serverAuthService.ts:211–230  ·  view source on GitHub ↗
(data: unknown)

Source from the content-addressed store, hash-verified

209}
210
211function parseGithubAccessTokenResponse(data: unknown): GithubAccessTokenResponse {
212 if (!data || typeof data !== "object") {
213 return {};
214 }
215
216 const record = data as Record<string, unknown>;
217
218 const intervalValue = record.interval;
219 const interval =
220 typeof intervalValue === "number" && Number.isFinite(intervalValue) && intervalValue > 0
221 ? intervalValue
222 : undefined;
223
224 return {
225 access_token: normalizeOptionalString(record.access_token),
226 error: normalizeOptionalString(record.error),
227 error_description: normalizeOptionalString(record.error_description),
228 interval,
229 };
230}
231
232function parseGithubUserResponse(data: unknown): GithubUserResponse {
233 if (!data || typeof data !== "object") {

Callers 1

pollGithubAccessTokenMethod · 0.85

Calls 1

normalizeOptionalStringFunction · 0.70

Tested by

no test coverage detected