feat(auth): add OAuth device login - #5
Merged
Conversation
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.
Summary
Headless Screenote users can now sign in from SSH, tmux, containers, and remote agents with
screenote login --device, without opening a browser or forwarding a callback port. The existing browser-based PKCE login remains the default for interactive machines.The CLI treats the device credential as a secret throughout the flow: it emits only a safe JSON authorization prompt, follows RFC polling and
slow_downbehavior, bounds in-flight requests by the grant expiry, and redacts raw or escaped device codes from terminal failures. Successful OAuth login also replaces a legacy token stored in the config file so old onboarding cannot silently override the new refreshable session; explicit compatibility flags remain accepted but hidden from help.Validation
go test ./...go test -race ./...go vet ./...gofmtand diff checksaccess_deniedwithout storing credentials.New concepts
OAuth device authorization grant
Device authorization separates the terminal that requests access from the browser where the user approves it. That makes it a better fit than a loopback callback when the CLI runs on a remote machine with no reachable browser port.
The default PKCE login remains preferable when the CLI and browser share a machine because it completes directly and avoids polling. Device authorization is reserved for explicit
--deviceuse on remote or browserless hosts.