Repository navigation
feat(native): add T3 Connect sign-in and account listing - #97
Merged
Merged
Conversation
Open
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.
Native users could not sign in to T3 Connect or list their published environments. This first CN-RELAY slice ports the CLI authorization-code/PKCE loopback flow, private credential persistence/refresh, sign-out, and OAuth-compatible account listing.
Relay connections and health checks are unavailable with native CLI OAuth sign-in. The UI says so explicitly, disables the connection action, and offers pairing links or SSH instead. No relay/server code is changed. Live Clerk sign-in and listing remain pending coordination with Trevor; no real window or browser has been launched.
Review findings
infra/relay/src/http/Api.ts:1069callsverifyClerkBearerTokenand requires the relay audience. The OAuth fallback inverifyRelayClientBearerTokenis used by bearer-client middleware, including listing, but not by that exchange.infra/relay/src/http/Api.test.ts:416-439tests the helper fallback, not OAuth acceptance by the exchange. No alternate OAuth-authorized relay-session endpoint exists. The CLI'sapps/server/src/cli/connect.tslinks/publishes the local host; it does not establish a remote client session. Native now makes only the supported account-list request, and no longer attempts JWT-only status/connect exchanges.The unused health model, endpoint health validation, and associated tests have been removed; only OAuth lifecycle, account listing, listing errors, and the disabled explanation remain.
Required upstream change
In
infra/relay/src/http/Api.ts,layerTokenApi.exchangeDpopAccessTokenneeds an OAuth-aware subject-token verification path using the verified OAuth user identity (the existingverifyRelayClientBearerTokenfallback is the relevant authentication behavior). Retain issuer/resource, allowed client/scopes, DPoP proof, and replay checks when issuing the bound relay token. The request contract inpackages/contracts/src/relay.tsshould accept an appropriate OAuth access-token subject type rather than declaring opaque OAuth access tokens to be JWTs. Add endpoint-level tests proving OAuth exchange works and invalid credentials/proofs remain rejected, while retaining the relay-audience JWT path. No environment-server authentication change is needed for the already-supported downstream DPoP flow. These upstream files are read-only for this worker.Verification
cargo clippy --workspace --all-targets -- -D warningsandvp run check:changedpassed.cargo test --workspace -- --test-threads=1: all 1,013 tests passed.cargo build -p t3-native --features snapshotpassed. Offscreen captures verify the signed-out screen and honest unavailable connection state.Local PNG evidence
Local files only; no browser automation or GitHub web uploads:
/tmp/t3-93-baseline.png/tmp/t3-93-cloud-final.png/tmp/t3-93-review-signed-out.png/tmp/t3-93-cleanup-listing.pngRemaining parity gaps
CN-RELAY remains
partial(#93). OAuth-aware upstream relay exchange is required before native can support relay health checks/connections. Onboarding, host linking/unlinking, multiple-route fallback, socket renewal, and discovery wakeup/polling integration remain unported.Sign out removes the worktree's
.t3/native/cloud-oauth.json. OAuth refresh is serialized and completes rotation/persistence even when the requesting discovery is cancelled. Credentials use native's existing owner-only atomic file storage.Built with GPT-6.1 Sol in Codex