Skip to content

fix: derive IdC OIDC region from device registration, not profile ARN - #126

Open
haxrob wants to merge 1 commit into
tickernelz:masterfrom
haxrob:fix/idc-oidc-region-from-device-registration
Open

haxrob wants to merge 1 commit into
tickernelz:masterfrom
haxrob:fix/idc-oidc-region-from-device-registration

Conversation

@haxrob

@haxrob haxrob commented Aug 25, 2026

Copy link
Copy Markdown

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant