mirror of
https://github.com/jwadow/kiro-gateway.git
synced 2026-04-25 01:15:57 +03:00
[GH-ISSUE #12] [Bug]: 401 Unauthorized when using AWS SSO credentials from kiro-cli (IAM Identity Center) #11
Labels
No labels
bug
bug
enhancement
enhancement
fixed
fixed
invalid
needs-info
needs-testing
pull-request
question
upstream
wontfix
workaround
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/kiro-gateway-jwadow#11
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @bhaskoro-muthohar on GitHub (Dec 30, 2025).
Original GitHub issue: https://github.com/jwadow/kiro-gateway/issues/12
Gateway Version: v1.0.7
What happened?
I'm attempting to use kiro-openai-gateway with credentials from kiro-cli (installed from kiro.dev), which authenticates via AWS IAM Identity Center. The gateway fails with 401 Unauthorized when trying to refresh the access token.
Setup:
~/.aws/sso/cache/(AWS SSO cache)KIRO_CREDS_FILEconfiguration pointing to SSO credentials fileError Details:
When running
manual_api_test.py, the token refresh fails immediately:Credentials File Format:
The AWS SSO cache file contains:
accessToken(bearer token)refreshTokenexpiresAt(ISO 8601 timestamp)region(ap-southeast-1)scopes(codewhisperer permissions)clientIdandclientSecretNote: The file does NOT contain a
profileArnfield, but I added it manually fromkiro-cli whoamioutput:arn:aws:codewhisperer:us-east-1:767809606079:profile/QGK3RDN4EE4VConfiguration (.env):
Questions:
refreshTokenfrom AWS SSO work with the Kiro API token refresh endpoint?The gateway appears designed for Kiro IDE credentials, but kiro-cli from kiro.dev uses AWS IAM Identity Center authentication. These may be incompatible authentication systems.
Debug Logs:
app_logs.txt:
request_body.json:
kiro_request_body.json:
error_info.json:
Additional Test Output (manual_api_test.py):
@prime399 commented on GitHub (Jan 1, 2026):
I am facing the same issue when testing this is what I got
openai.InternalServerError: Error code: 500 - {'detail': "Internal Server Error: Client error '401 Unauthorized' for url 'https://prod.us-east-1.auth.desktop.kiro.dev/refreshToken'\nFor more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401"}@uratmangun commented on GitHub (Jan 3, 2026):
you can use this for the refresh token for oidc in kiro-cli,
sorry i cant push my kiro-open-gateway coz i got a lot of my api key there i havent clean it up but i think using ai you can implement this yourself i will help when i have time but i can assure that kiro cli is working great with this, sqlite data is in here
/.local/share/kiro-cli/data.sqlite3so you need to extract it yourself then authenticate against it check how kiro cli working by cloning the https://github.com/aws/amazon-q-developer-cli and ask ai to implement the auth thats how i got it working@jwadow commented on GitHub (Jan 3, 2026):
@bhaskoro-muthohar @prime399 @uratmangun
Hi guys,
I've implemented AWS SSO OIDC support based on your feedback. The gateway now automatically detects the authentication type.
Auto-detection: If credentials contain clientId AND clientSecret → uses AWS SSO OIDC endpoint
Two options for kiro-cli:
Option A: JSON file
Option B: SQLite database (recommended)
Testing needed:
Please report: which option you used, whether it works, any errors.
⚠️ Note: I don't have access to AWS IAM Identity Center / kiro-cli credentials myself, so I implemented this based on the amazon-q-developer-cli source code and your descriptions. Your testing feedback is essential before I can publish a release.
@uratmangun commented on GitHub (Jan 4, 2026):
i actually doesnt need this anymore because its working on my side using AI but i want to help debugging it so this is the OPTION A result its working:
for OPTION B:
i got error this is my env:
when i run
kiro-cli whoamii got only this one:i also ask ai whats wrong with the auth also showing the amazon-q-cli to check how the auth works and he said that profile_arn is optional for sso oidc as well:
this is the edited manual_api_test.py you might want to take a look, thanks so much for building this btw i also take a look at this lol https://github.com/jwadow/kiro-openai-gateway/issues/11 this is hidden gem for real didnt know that we can trigger thinking lol
@jwadow commented on GitHub (Jan 4, 2026):
Yeah, it's a pretty funny thing. I saw something similar (as user) in the https://github.com/GewoonJaap/gemini-cli-openai, but I never dug into their code. And the funniest thing is, it works and solves a bunch of problems with context poisoning on kiro's opus 4.5.
I corrected code by your comments, in theory everything should work correctly. So I’m closing the issue as resolved (I hope if something happens you can write here, I’m new to Github)
Thank you for your contribution.