feat(kiro): add IDC auth code flow, redesign fingerprint and API protocol#395
feat(kiro): add IDC auth code flow, redesign fingerprint and API protocol#395luispater merged 2 commits intorouter-for-me:mainfrom
Conversation
…int system - Add IAM Identity Center (IDC) authentication with CLI flags (--kiro-idc-login, --kiro-idc-start-url, --kiro-idc-region) and login flow - Add ProfileArn auto-fetching in Execute/ExecuteStream for imported IDC accounts - Simplify endpoint preference with map-based alias lookup and getAuthValue helper - Redesign fingerprint as global singleton with external config and per-account deterministic generation - Add StartURL and FingerprintConfig fields to Kiro config - Add AgentContinuationID/AgentTaskType support in Kiro translators - Add comprehensive tests for executor, fingerprint, SSO OIDC, and AWS helpers - Add CLI login documentation to README
- Add kiro-claude-sonnet-4-6 alias mapping to claude-sonnet-4-6
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors the Kiro authentication and API interaction layers to align more closely with the behavior of the official Kiro IDE. The primary goal is to enhance compatibility, stability, and feature parity, particularly for AWS IAM Identity Center (IDC) users, by introducing a robust authorization code flow and a redesigned, deterministic fingerprinting system. These changes streamline the login experience, improve API request consistency, and lay the groundwork for more reliable integration with Kiro services. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces comprehensive support for AWS IAM Identity Center (IDC) authentication within the CLI, alongside significant refactoring of Kiro's internal authentication and API request mechanisms. Key changes include adding new CLI flags (--kiro-idc-login, --kiro-idc-start-url, --kiro-idc-region, --kiro-idc-flow) and updating README.md files to document these new login methods. The authentication flow now supports both device code and authorization code flows for IDC. Internally, the fingerprinting system has been overhauled to use a global, configurable manager that generates deterministic, account-specific fingerprints for various SDK versions (OIDC, runtime, streaming) and OS/Node/Kiro versions, replacing previous static or less dynamic User-Agent headers. API request functions have been refactored to dynamically determine endpoints and apply these new fingerprint-based headers. The handling of profileArn and user email fetching has been improved, with profileArn now being suppressed for Builder ID and AWS SSO OIDC methods to prevent 403 errors, and fetched dynamically for imported accounts if missing. Additionally, the KiroKey configuration now supports start-url and region fields for pre-configuring IDC details, and a new KiroFingerprintConfig allows overriding default fingerprint values. Conversation state handling for Claude and OpenAI requests has been enhanced to extract conversationId and continuationId from message metadata, improving session continuity.
Background
Kiro auth previously supported Builder ID (device code + auth code), IDC (device code via interactive menu only), and social login (Google/GitHub token import). Several aspects didn't match real Kiro IDE behavior:
KiroHashincludedtime.Now().UnixNano(), changing on every restart; struct contained unused browser fields (ScreenResolution,ColorDepth, etc.) not present in real IDE traffic; all endpoints shared a single SDK version pool, while the real IDE uses different versions for OIDC / runtime / streamingaws-sdk-rust/1.3.9+app/AmazonQ-For-CLI, inconsistent with Kiro IDEcodewhisperer.us-east-1.amazonaws.com, while the real IDE has moved to REST viaq.{region}.amazonaws.comRefreshTokenWithRegionused a completely different hardcoded header setSummary
Kiro Auth & Fingerprint
LoginWithIDCAuthCode; CLI flags--kiro-idc-login,--kiro-idc-start-url,--kiro-idc-region,--kiro-idc-flowallow direct IDC login without interactive prompts;start-urlfield added to config;RefreshTokenWithRegionnow falls back to default region when emptysha256(accountKey), three SDK version pools (OIDC3.7xx/ runtime1.0.0/ streaming1.0.27), removed unused browser fields, external config override viakiro-fingerprintSetOIDCHeaders()getUsageLimits/ListAvailableModelsmoved from JSON-RPC to REST (q.{region}.amazonaws.com+ GET);FetchProfileArntries newListAvailableProfilesfirst, falls back to legacyListProfilesKiro Translator
AgentContinuationID/AgentTaskTypeto conversation state; extractconversationId/continuationIdfrommessages[].additional_kwargsOther
kiro-claude-sonnet-4-6model aliastool_resultimages placed insidefunctionResponse.parts;mime_type→mimeType; primary model list cache with fallback; multi-auth model backfillTest plan
--kiro-idc-login --kiro-idc-start-url <url>--kiro-idc-login --kiro-idc-start-url <url> --kiro-idc-flow device--kiro-aws-login/--kiro-aws-authcodeI've tested the IDC-related flows. Additional testing and feedback on other auth methods are appreciated.