Repository navigation
Add device login and use one OAuth client per environment - #5
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sandbox signs in with caynxy5ad and production with caynqpyde. status reports the client_id of each login. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
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.
Purpose
Let a user sign in to Proof from a machine that cannot receive the loopback redirect (SSH, remote machine, sandbox), with the OAuth 2.0 Device Authorization Grant (RFC 8628).
Approach
x401-cli login --device(also accepted bytoken, which signs in when there is no login). The loopback authorization code flow stays the default.Uses the oauth4webapi device functions with the same public client as the loopback login. The CLI reads
device_authorization_endpointfrom the server metadata, then polls the token endpoint everyintervalseconds (plus 5 s onslow_down) untilexpires_inor--timeout.It opens the browser at
verification_uri_completewhen it can. Either way it prints the URL and the code on stderr:Without a browser (
--no-browser, no display, or a failed open), the first two lines becomeTo sign in, go to:. This block is the one exception to the one-line-per-event stderr contract (CLAUDE.md rule 3).Tokens are stored like the loopback login.
access_deniedexitscancelled,expired_tokenexitsexpired, other errors exitunauthorized.The browser opener now waits for
open/xdg-open/startand reports a failure, and treats Linux without a display as "cannot open". The loopback login prints its URL instead of failing when the browser does not open.The CLI now has one public client per environment:
caynxy5adfor sandbox andcaynqpydefor production, instead ofcag5xwbbzfor both.statusshows theclient_idof each login (in--json,client_idmoved from the top level into eachloginsentry).Server side: notarize-api #23195 (device grant) and notarize-web #26685 (approval page).
Testing
yarn check-all(38 tests, including production signs in with the production client): device happy path, browser opened and not opened,slow_down, denied, expired, timeout,invalid_client, no device endpoint🤖 Generated with Claude Code