kiro-social-onboarder
Automate Kiro CLI account onboarding with social Google or GitHub login through the required HTTP proxy, local Kiro SQLite auth cleanup without logout, email-aware llm-access Kiro account import, prox
SKILL.mdskills/kiro-social-onboarder/SKILL.md
GitHubKiro Social Onboarder
Boundaries
- Never run
kiro-cli logout; remove local metadata keys instead. - Never store provider passwords, 2FA codes, access tokens, refresh tokens, or raw token JSON in the skill or handoff.
- Use the HTTP proxy for the whole login flow. Default proxy:
http://127.0.0.1:11111. - Delete llm-access accounts only by exact explicit name, and only when the user asked to replace or clean that account.
- Keep the final verification centered on
kiro-cli whoami,auth_method=social, the expected social provider, and refreshed Kiro balance.
One-Command Flow
Use the bundled script for the standard path:
read -rsp 'Google password: ' KIRO_GOOGLE_PASSWORD; echo
export KIRO_GOOGLE_PASSWORD
python3 skills/kiro-social-onboarder/scripts/onboard_kiro_social_google.py \
--email user@example.com \
--account-name kiro-user-google-social \
--replace-account
unset KIRO_GOOGLE_PASSWORD
For refreshing an existing GitHub-backed account that has fallen into
auth_401, use the GitHub-specific script without --account-name. It probes
the refreshed credentials with a temporary account, uniquely matches the
upstream user_id to an existing llm-access Kiro account, then writes the new
token pair back to that existing account:
python3 skills/kiro-social-onboarder/scripts/onboard_kiro_social_github.py \
--manual-timeout-seconds 600
When old records have no current upstream user_id, require the operator to
confirm the existing llm-access account name explicitly:
python3 skills/kiro-social-onboarder/scripts/onboard_kiro_social_github.py \
--github-login Prosacco1 \
--existing-account-name laohan39 \
--manual-timeout-seconds 600
This path updates only that existing account and preserves its proxy and scheduling settings. Use refreshed quota as validation evidence, not an automatic identity key: quota values change across reset periods and can collide between accounts.
For credential-prefilled GitHub login, put the password in an environment variable rather than a shell argument. The helper fills the GitHub username and password, then waits for manual 2FA or unusual verification:
read -rsp 'GitHub password: ' KIRO_GITHUB_PASSWORD; echo
export KIRO_GITHUB_PASSWORD
python3 skills/kiro-social-onboarder/scripts/onboard_kiro_social_github.py \
--github-login gfryuuu \
--manual-timeout-seconds 600
unset KIRO_GITHUB_PASSWORD
2FA codes are never passed to the script; complete 2FA and unusual verification in the launched browser when prompted.
For importing a new GitHub-backed account under an explicit name, pass
--account-name:
python3 skills/kiro-social-onboarder/scripts/onboard_kiro_social_github.py \
--account-name kiro-user-github-social
The script:
- Backs up
~/.local/share/kiro-cli/data.sqlite3. - Deletes only Kiro auth metadata keys from local SQLite.
- Starts Kiro social device authorization through the proxy.
- Opens an isolated Chrome profile through the proxy and drives the visible provider/Kiro pages through DevTools.
It must inspect the DOM and click real
button/a/role=buttoncontrols such asNext,Approve,Continue, andRestart. - Approves the Kiro device code and polls the social token endpoint.
- Writes
kirocli:social:tokenandapi.codewhisperer.profilelocally. - Verifies
kiro-cli whoamithrough the proxy and parses theEmail:line when present. - Runs
kiro-local-account-importerdry-run and apply againsthttp://127.0.0.1:19182. Proxy assignment is delegated to the importer, which chooses the least-used active United States proxy first and uses latency only as a tie-breaker. - Writes parsed email into the llm-access Kiro account through the same
import-authpath that updates the refreshed social token. - Refreshes balance and fails unless the account is
KIRO STUDENTwith at least1000usage limit by default. - Removes temporary browser profiles and token response files.
The GitHub script follows the same Kiro/device-code/import/verification path.
Its DevTools helper can submit the GitHub login form when --github-login and
KIRO_GITHUB_PASSWORD are available, then it waits for 2FA, device
verification, or OAuth consent in the visible browser session. It also assists
Kiro-side Continue/Approve controls. Automated GitHub/Kiro browser actions
wait a random 2–6 seconds between steps by default to avoid racing page
transitions. Set KIRO_STEP_DELAY_MIN_MS and KIRO_STEP_DELAY_MAX_MS to
override the range; set both to 0 only when the delay must be disabled. When
--account-name is omitted, it
uses a temporary probe account only to refresh balance and identify the
existing account by a unique upstream user_id; the probe account is deleted
when it is not automatically removed by duplicate detection. The script stops
instead of guessing when stable identifiers are absent or conflict.
When GitHub itself must be entered through Continue with Google, use the
sibling kiro-github-google-onboarder skill. It supplies a specialized browser
driver while reusing this script as the canonical device-token, SQLite,
llm-access import, proxy assignment, and balance-verification implementation.
Kiro Admin Lookup Rules
- Kiro's device authorization API expects
loginProvider: "Github"for GitHub login. Do not send the display spellingGitHub; the API rejects it. - Do not assume
GET /admin/kiro-gateway/accounts?limit=10000&offset=0returns every account. The admin API capslimitserver-side, so full-list scans must followhas_morewith increasingoffset. - For an exact suspected account name, prefer the server-side search first:
GET /admin/kiro-gateway/accounts?q=<account-name>. - For 401 repair batches, prefer the issue filter:
GET /admin/kiro-gateway/accounts?issue=auth_401. - If a local scan and the admin UI disagree, treat the scan as suspect until
the query is repeated with
q=...or a verified paginated fetch.
Required Options
--email: Google account email.--account-name: llm-access Kiro account name. Preferkiro-<localpart>-google-social.- Password source:
KIRO_GOOGLE_PASSWORDby default, or interactive hidden prompt.
For GitHub:
--account-name: optional. Omit it when refreshing an existing 401 account and let the script match by a unique upstreamuser_id. Provide it only for explicit new-account import or exact-name replacement. Preferkiro-<localpart>-github-socialfor new accounts.--existing-account-name: operator-confirmed existing llm-access account to refresh directly when upstream identity metadata cannot match the old record. Keep it separate from--account-name, which is the new-import path.--github-login: optional GitHub username or email for login prefill. If omitted and--account-nameis present, the script may use--account-nameas the GitHub login when a password is available.- GitHub password source:
KIRO_GITHUB_PASSWORDby default via--password-env. Do not pass passwords on the command line. - No 2FA option is accepted; use the launched browser for 2FA.
Useful Options
--proxy http://127.0.0.1:11111: override the login proxy.--admin-base-url http://127.0.0.1:19182: override local mapped llm-access admin API.--replace-account: delete the exact target account before importing; for safety this requires--account-name.--delete-account-name NAME: delete an exact mistakenly imported account before the flow.--manual-timeout-seconds 300: time allowed for manual CAPTCHA/MFA completion if Google requires it.--expect-usage-limit 1000: required usage limit for verification.--no-expect-student: allow non-student accounts, but still print the balance.
For GitHub, --manual-timeout-seconds defaults to 600 to allow manual 2FA
and OAuth consent. --password-env NAME changes the environment variable used
for GitHub password prefill.
Failure Handling
- If Google shows CAPTCHA or MFA, complete it in the launched isolated browser; the script keeps polling until the manual timeout.
- If GitHub shows login, 2FA, device verification, or OAuth consent, complete it in the launched isolated browser; the script keeps polling until the manual timeout.
- If Google shows
Something went wrongwithRestart, clickRestartand continue the same OAuth flow. - If the import step fails after account creation, query the exact account name before retrying. Do not create a second account name unless the user requests it.
- If balance is not
KIRO STUDENTor usage limit is below1000, report the account as not acceptable and do not hide the failure. - If a wrong AWS/IDC account was imported, delete that exact account via llm-access admin API, then rerun the social flow. Do not call logout.
Verification Commands
HTTP_PROXY=http://127.0.0.1:11111 \
HTTPS_PROXY=http://127.0.0.1:11111 \
ALL_PROXY=http://127.0.0.1:11111 \
kiro-cli whoami
curl -fsS -X POST \
http://127.0.0.1:19182/admin/kiro-gateway/accounts/<account-name>/balance \
| jq '{subscription_title, usage_limit, remaining, current_usage, user_id}'