Repository navigation
feat(oauth): let oauthSessionCommand take the sign-ins a CLI kept before - #3361
Merged
Merged
Conversation
zm and drive move to the shared browser sign-in (NEED-2934 B), and nobody may have to sign in again. oauthSessionCommand gains optional options: - codec: the entry's format (zoomTokenCodec, driveSessionCodec). - legacyAccounts(env, profile): older entries, as an account or as a service and an account. They are copied on read and removed at session end. A run with moved folders only reads them. - startOptions: more session start options, which preset reads. - preset may be async. In start it gets the sign-in steps, so it can ask for a missing client id with --answer-stdin. - verify may return extra, saved in the entry (drive's principal). - afterSignIn(command, signedIn): gets the client the sign-in used. - profiles(env): the profiles session list names. session start gains --answer-stdin with a pasted redirect. status gives expires_at. session list rows gain state. Both the token and the oauth list mark a profile unknown instead of failing when the keyring cannot be reached or an entry is broken. credentialStorage reads older entries under another service, copies one found in the private file within the file, and removes older entries on remove outside moved runs. storageOf, timeLimit and withTimeLimit are exported, since CLIs copied them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 25, 2026
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.
Task
Owner decision NEED-2934 B: zm and drive use cli-core's shared browser sign-in,
oauthSessionCommand, instead of their own session code. Two agents stopped on gaps in cli-core. This PR closes them, so both CLIs can move and nobody signs in again.Why
{accessToken, refreshToken, expiresAt, scopes}entries, and older ones underzoom-cli:<old config folder>/<client id>:<profile>. The shared command read only the standard format underoauth:<provider>:<profile>.principalsaved with the entry, picks scopes with--grant, and keeps its profiles in its own config.--answer-stdin, and saves the client a sign-in used (WC-SECR-25).session listin both shared commands. Desktop reads profiles from it.What
New optional
oauthSessionCommandoptions (it is@experimental, so this is a 1.x minor):codec: the entry's format.legacyAccounts(env, profile): older entries, as an account or as{ service, account }. Copied on read, removed atsession end, only read in a run with moved folders.startOptions: moresession startoptions.presetreads them fromcommand.opts().presetmay be async, and in start it gets the sign-in steps, so it can ask for what it lacks.verifymay returnextra, saved in the entry by the codec.afterSignIn(command, signedIn): runs after the sign-in is kept, with the client it used.profiles(env): the profilessession listnames.Also:
session start --answer-stdinwith a pasted redirect, for every CLI on the shared command.session statusgivesexpires_at.session listrows gainstate. A profile whose sign-in cannot be read issigned_in: null,state: "unknown", and the list goes on. Same fix intokenSessionCommand.credentialStorage: older entries under another service. An entry found in the private file is copied within the file, never into the keyring.removeremoves older entries too, outside moved runs.storageOf,timeLimitandwithTimeLimitare exported. Five CLIs and cli-template copied them.No per-CLI output shapes. zm and drive will list the shape change as breaking in their own changelogs.
Testing
pnpm typecheck,pnpm lint,pnpm docs:check.vitest runonsrc/cli/oauth-session.test.ts,src/cli/token-session.test.ts,src/oauth, and the other files that use the session commands. New tests withmemoryKeyring(): a custom codec read, an older entry under another service read and copied in the owner's run and removed at end, a moved run that reads it but never copies or removes it, a start option reaching the preset,verify's extra saved,afterSignIngetting the client,--answer-stdinasking for the client and reading the pasted redirect, and both lists with a keyring that cannot be reached.🤖 Generated with Claude Code