Kiro icon indicating copy to clipboard operation
Kiro copied to clipboard

kiro-cli does not persist refreshed tokens to SQLite database

Open bhaskoro-muthohar opened this issue 10 months ago • 2 comments

Before opening, please confirm:

  • [x] I have searched for duplicate or closed issues

Operating System

macOS (darwin)

Kiro Version

kiro-cli 1.23.1

Bug Description

When kiro-cli refreshes tokens (after the initial access token expires), it keeps the new tokens in memory only and does not persist them back to the SQLite database (~/Library/Application Support/kiro-cli/data.sqlite3).

This causes issues for external tools that read credentials from the SQLite database (e.g., kiro-gateway, custom integrations) - they get stale/invalid refresh tokens.

Evidence

# Check token expiry in SQLite
sqlite3 ~/Library/Application\ Support/kiro-cli/data.sqlite3 \
  "SELECT json_extract(value, '$.expires_at') FROM auth_kv WHERE key='kirocli:odic:token';"
# Output: 2026-01-11T14:33:30.786627Z (already expired)

# Run kiro-cli - it works fine (refreshes token in memory)
echo "hi" | kiro-cli chat --no-interactive
# Output: Works, responds in 3s

# Check SQLite again - unchanged!
sqlite3 ~/Library/Application\ Support/kiro-cli/data.sqlite3 \
  "SELECT json_extract(value, '$.expires_at') FROM auth_kv WHERE key='kirocli:odic:token';"
# Output: 2026-01-11T14:33:30.786627Z (still the old expired value)

kiro-cli successfully refreshed its token (it worked), but SQLite still has the old expired token.

Expected Behavior

When kiro-cli refreshes tokens via AWS SSO OIDC, it should persist the new access_token, refresh_token, and expires_at back to the SQLite database.

Impact

  • External tools reading from SQLite get invalid credentials
  • Users must run kiro-cli logout && kiro-cli login periodically instead of relying on automatic refresh
  • Related: jwadow/kiro-gateway#14, jwadow/kiro-gateway#29

Additional Context

The SQLite database is located at:

  • macOS: ~/Library/Application Support/kiro-cli/data.sqlite3
  • Linux: ~/.local/share/kiro-cli/data.sqlite3

Table: auth_kv, Key: kirocli:odic:token

bhaskoro-muthohar avatar Jan 11 '26 13:01 bhaskoro-muthohar

Cheapest Anthropic & OpenAI-Compatible API 🚀

Works with Claude Code, Cursor, Cline, Void, Continue, Kilo Code, OpenClaw, OpenCode, LangChain, Obsidian, IntelliJ — any OpenAI-compatible client.

💰 Pricing (1 credit ≈ $1 original Anthropic)

Credits Price Tokens
1k $5 ~100M
5k $15 ~500M
10k $30 ~1B

🤖 Models: claude-opus-4-6 / sonnet-4-6 / haiku-4-5 (1M ctx + websearch)

✅ Why us?

  • 100 trial credits before payment
  • Credits issued before payment
  • Any country, any payment method
  • 400+ clients, quality guarantee
  • We can prove Opus is real and explain pricing

📩 Telegram: @yon_sup

shalegeomancerslicer avatar Apr 09 '26 01:04 shalegeomancerslicer

Is there any updates on this?

Cabeda avatar Jul 23 '26 09:07 Cabeda