{"record":{"id":"9193348cea8964b5","repo":"diegosouzapw/OmniRoute","slug":"failed-to-start-device-authorization-error","errorCode":null,"errorMessage":"Failed to start device authorization: ${error}","messagePattern":"Failed to start device authorization: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/lib/oauth/services/kiro.ts","lineNumber":80,"sourceCode":"  ) {\n    assertValidAwsRegion(region);\n    const endpoint = `https://oidc.${region}.amazonaws.com/device_authorization`;\n\n    const response = await fetch(endpoint, {\n      method: \"POST\",\n      headers: {\n        \"Content-Type\": \"application/json\",\n      },\n      body: JSON.stringify({\n        clientId,\n        clientSecret,\n        startUrl,\n      }),\n    });\n\n    if (!response.ok) {\n      const error = await response.text();\n      throw new Error(`Failed to start device authorization: ${error}`);\n    }\n\n    const data = await response.json();\n    return {\n      deviceCode: data.deviceCode,\n      userCode: data.userCode,\n      verificationUri: data.verificationUri,\n      verificationUriComplete: data.verificationUriComplete,\n      expiresIn: data.expiresIn,\n      interval: data.interval || 5,\n    };\n  }\n\n  /**\n   * Poll for token using device code (AWS Builder ID/IDC)\n   */\n  async pollDeviceToken(\n    clientId: string,","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/oauth/services/kiro.ts#L62-L98","documentation":"KiroService.startDeviceAuthorization: after registering a client, the POST to https://oidc.<region>.amazonaws.com/device_authorization with clientId/clientSecret/startUrl returned non-ok; the raw body is appended. Usually a startUrl the registered client cannot use, an expired/invalid clientSecret, or AWS throttling.","triggerScenarios":"Thrown at src/lib/oauth/services/kiro.ts:80 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the appended AWS error code","Confirm startUrl is the exact Builder ID / IDC URL the user chose","Re-register the client and retry with the new credentials if the secret expired","Back off and retry on ThrottlingException"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}