Conversation
RvVeen
added a commit
to Servoy/opencode-kiro-auth
that referenced
this pull request
Sep 12, 2026
Implements upstream tickernelz#118 and tickernelz#126. An IdC account has two regions: the OIDC region that issued the SSO session and refresh token, and the service region where the Q Developer profile lives. The sync layer set both from the profile ARN, and token.ts builds the refresh URL from oidcRegion — so any account whose Identity Center and profile differ refreshed against an endpoint that never issued the token. The first hour works, then every refresh 400s with 'Invalid token provided'. Upstream confirmed by probing both endpoints. Prefer the device registration's region, then the session's, then the profile's, validating rather than normalising so an unrecognised value falls through instead of silently becoming us-east-1.
RvVeen
added a commit
to Servoy/opencode-kiro-auth
that referenced
this pull request
Sep 12, 2026
, tickernelz#126) Implements upstream tickernelz#118 and tickernelz#126. An IdC account has two regions: the OIDC region that issued the SSO session and refresh token, and the service region where the Q Developer profile lives. The sync layer set both from the profile ARN, and token.ts builds the refresh URL from oidcRegion — so any account whose Identity Center and profile differ refreshed against an endpoint that never issued the token. The first hour works, then every refresh 400s with 'Invalid token provided'. Upstream confirmed by probing both endpoints. Prefer the device registration's region, then the session's, then the profile's, validating rather than normalising so an unrecognised value falls through instead of silently becoming us-east-1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix for token refresh issue for when the Q profile and Identity Center are in different regions. Here the refresh reaches a regional endpoint that never issued the device registration and fails with HTTP 400 Invalid token provided. As such, tokens last an hour, so sessions start fine and break mid-session.
syncFromKiroCli sets oidcRegion = serviceRegion, where serviceRegion is derived from the Q Developer profile ARN. refreshAccessToken then POSTs the Identity Center refresh to https://oidc..amazonaws.com/token.
isValidRegion is used rather than normalizeRegion because the latter returns us-east-1 for unrecognised input, which would substitute a wrong region instead of falling back.
region still comes from the ARN, so the q..amazonaws.com inference endpoint is unchanged.