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

Function POST

apps/web/src/app/api/device-auth/codes/route.ts:10–29  ·  view source on GitHub ↗
(request: Request)

Source from the content-addressed store, hash-verified

8import {
9 buildDeviceAuthVerificationUrl,
10 getDeviceAuthAppModeFromRequestUrl,
11} from '@/app/device-auth/device-auth-url';
12import { withRestTiming } from '@/lib/observability/request-timing';
13
14export const POST = withRestTiming('/api/device-auth/codes', async (request: Request) => {
15 const headersList = await headers();
16 const userAgent = headersList.get('user-agent') || undefined;
17 const ipAddress = headersList.get('x-forwarded-for') || undefined;
18
19 try {
20 const { code, userCode, deviceCode, expiresAt } = await createDeviceAuthRequest({
21 userAgent,
22 ipAddress,
23 });
24
25 const verificationUrl = buildDeviceAuthVerificationUrl(APP_URL, userCode, {
26 app: getDeviceAuthAppModeFromRequestUrl(request.url),
27 });
28
29 return NextResponse.json({
30 code,
31 user_code: userCode,
32 device_code: deviceCode,

Callers

nothing calls this directly

Calls 6

createDeviceAuthRequestFunction · 0.90
getMethod · 0.65
jsonMethod · 0.65
headersFunction · 0.50

Tested by

no test coverage detected