auth: import a captured refresh token (#55) - #60
Open
ironlukas1 wants to merge 2 commits into
Open
Conversation
Google Sign-In accounts have no password, so `auth login` is unusable for them, and `LIFTOFF_REFRESH_TOKEN` only helps once you already hold a token. The one way such an account can get a refresh token is to read it off the phone app with an HTTPS proxy — but there was no CLI affordance for putting it anywhere, so it meant hand-writing auth.json with a correctly formatted `expires_at`. Add `auth import`: - `--refresh-token` (or stdin): exchanges the token via user.refreshToken, which both verifies it and fills in the expiry, then saves it to the usual token file. - `--no-verify` with `--access-token` + `--expires-at`: writes the captured triple with no network call. This wires up the existing but previously unreferenced auth.SaveFromCapture. Additive to the auth surface (CONTRACT §5); `--help` stays hermetic (§7). Docs updated in README and `prime`. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015zkLbCGpBdq4SoCitH1dZZ
There was a problem hiding this comment.
Pull request overview
Adds a new liftoff-export auth import subcommand to let users persist a proxy-captured Liftoff refresh token to the standard on-disk auth store, primarily to support Google Sign-In accounts that cannot use auth login (Refs #55).
Changes:
- Introduces
auth importwith a default “verify + exchange + save” path and a--no-verifyoffline write path. - Documents the new flow and Google Sign-In limitations in CLI docs/help text.
- Adds command-level tests to ensure
--no-verifywrites tokens to disk and validates required flags.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| README.md | Documents auth import usage and the Google Sign-In proxy-capture workflow. |
| cmd/prime.go | Updates “GOTCHAS” to mention persisting a captured token via auth import. |
| cmd/auth.go | Adds the auth import Cobra subcommand and its flag handling. |
| cmd/auth_test.go | Adds tests covering auth import --no-verify success and error cases. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.
Why
I hit #55 from the reporter's side: my Liftoff account was created with Google Sign-In, so I have no password and
auth loginis a dead end.LIFTOFF_REFRESH_TOKENonly helps once you already hold a token, and per the maintainer's note on #55 the only way a Google account can get one is to read it off the phone app with mitmproxy/Proxyman.The gap this PR closes: once you have captured that token, there's no CLI affordance for storing it. Today it means hand-writing
~/.config/liftoff-export/auth.jsonwith a correctly formattedexpires_at.internal/auth.SaveFromCapturewas already written for exactly this case but nothing referenced it.What
New
auth importsubcommand:auth import --refresh-token "$RT"(or token on stdin)user.refreshToken— verifies it and fills in the real expiry — then saves to the normal token file.auth import --no-verify --refresh-token … --access-token … --expires-at …auth.SaveFromCapture.Everything else is unchanged.
Contract / scope notes
auth login/logout/refresh/statusstill behave exactly as before (CONTRACT §5).auth import --helpmakes no network call (§7); verified manually and the existing hermeticity posture is untouched.user.signInrequest capture the maintainer asked for on Google Sign-In accounts have no way to authenticate via auth login #55. This just gives Google-only accounts a supported path for the proxy-captured token instead of a hand-edited JSON file, so I've marked itRefs #55, notCloses.Tests
cmd/auth_test.go:--no-verifyround-trips the captured tokens to disk with no network,--no-verifywithout its companion flags is a clean error, and an empty refresh token is a clean error.go vet ./...,go test ./..., and theTestContractFormatscompat suite all pass locally.Try it
go build -o /tmp/liftoff-export . /tmp/liftoff-export auth import --no-verify \ --refresh-token rt --access-token at --expires-at 2099-01-02T15:04:05Z🤖 Generated with Claude Code
https://claude.ai/code/session_015zkLbCGpBdq4SoCitH1dZZ