You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Enhancement]: Browser sign-in with PKCE for OIDC upstreams #1697
nemo-relay auth login (#1611) supports only the OAuth device grant. Some issuers do important work on their browser consent page, and the device grant never reaches it.
OpenRouter is one of them. It creates the user's grant and its API key on its consent page. The device grant is approved on Clerk's own page, so:
A user who never signed in through a browser gets HTTP 401 on every request.
A user who did gets that earlier key reused without being asked.
Proposed enhancement
auth login uses an authorization code with PKCE (S256) by default, returned to a loopback redirect on http://127.0.0.1:<port>/callback.
The listener accepts only the redirect that carries this attempt's state. It checks iss when the issuer sends it.
Relay opens the default browser and always prints the address.
Over SSH, the user approves on any device and pastes the redirect address back into the terminal.
--no-browser only prints the address. --callback-port fixes the port, for a port forwarded over SSH.
The device grant stays available behind --device.
Discovery reads authorization_endpoint, with the same origin check as the token endpoint.
Runtime contract and binding impact
N/A. This changes the CLI sign-in only. The gateway reads the stored sign-in as it does today.
Alternatives considered
Keep the device grant as the default and add the browser flow behind a flag. This keeps today's behavior, but OpenRouter users then get the 401 by default.
Device grant only. This works with no browser, but it cannot reach a consent page.
Acceptance criteria
auth login signs in through the browser with PKCE. --device keeps the device grant.
Paste-back works over SSH and refuses an address from another attempt.
Tests cover the loopback round trip, paste-back, a wrong state, a declined sign-in and the timeout.
basic-usage.mdx documents the flow, paste-back and --device.
The browser sign-in part of #1678 implements this. I'll split it to match the design agreed here.
Activity
refactor(cli): keep only the browser sign-in
test(cli): cover the issuer, missing endpoint and refused code paths
fix(cli): match iss exactly and stop the browser page claiming success
fix(cli): hold the authorization endpoint to the issuer origin