// device-pair-login.mjs — On-device browser login for AC identity switching. // Opened by the native OS: /api/device-pair-login?code=XXXXXX // Handles Auth0 login flow, then claims the device-pair code with user's // handle, AC token, and device tokens (Claude + GitHub). import { respond } from "../../backend/http.mjs"; export async function handler(event) { const params = new URLSearchParams(event.rawQuery || ""); const code = params.get("code") || ""; const baseUrl = process.env.URL || "https://aesthetic.computer"; const html = ` AC Device Login

AC Device Login

${code || "------"}

Sign in to switch this device's identity.

`; return { statusCode: 200, headers: { "Content-Type": "text/html", "Access-Control-Allow-Origin": "*", "Cache-Control": "no-store", }, body: html, }; }