feat: auto re-auth via kiro-cli login when all accounts are permanently unhealthy#80
Open
leecoder wants to merge 1 commit intotickernelz:masterfrom
Open
feat: auto re-auth via kiro-cli login when all accounts are permanently unhealthy#80leecoder wants to merge 1 commit intotickernelz:masterfrom
leecoder wants to merge 1 commit intotickernelz:masterfrom
Conversation
…ly unhealthy When all accounts become permanently unhealthy (e.g. after invalid_grant, account suspension, or token expiry), instead of throwing an error, the plugin now automatically runs 'kiro-cli login' to trigger browser-based re-authentication via https://app.kiro.dev/signin. After login completes, fresh tokens are synced from the kiro-cli database and the request loop resumes with valid credentials. This is an alternative approach to tickernelz#70 that uses kiro-cli's native browser login flow instead of OpenCode's built-in OAuth device-code flow.
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.
Problem
When all accounts become permanently unhealthy (e.g. after
invalid_grant, account suspension, or token expiry), the plugin throws:This requires the user to manually restart OpenCode and re-authenticate.
Approach
Alternative to #70 — instead of using OpenCode's built-in OAuth device-code flow (
client.provider.oauth.authorize()), this useskiro-cli loginto trigger the native browser-based re-authentication viahttps://app.kiro.dev/signin.This approach works for users who authenticate through the Kiro CLI web login flow rather than the IDC device-code flow.
Changes
allAccountsPermanentlyUnhealthy()is detected, instead of throwing, runkiro-cli loginas a subprocess to trigger browser-based re-authplugin.tsorauth-handler.ts— onlyrequest-handler.tsis modifiedResult
Users no longer need to manually restart or re-authenticate — the plugin recovers automatically by launching
kiro-cli loginwhen tokens go permanently invalid.Related: #43, #70