feat: OAuth device flow with QR code - #39
Merged
Merged
Conversation
Adds a second oauth method 'Berget Code Seat - QR or device code' for headless environments (SSH/CI) where the PKCE magic link cannot open a browser. Renders a scannable half-block QR code in the instructions dialog, links verification_uri_complete (user_code embedded) via the url field, and polls the token endpoint with slow_down/expiry handling.
Review feedback on #39: - response.json() in the poll loop could throw on non-JSON bodies (e.g. a 502 HTML page from the gateway); extracted fetchTokenPollBody which treats transport/parse errors as retryable until the deadline - add unit tests for extractTokenResult and handleTokenPollError
This was referenced Sep 12, 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.
Vad
Ny oauth-metod "Berget Code Seat - QR or device code" bredvid magic link, för headless-miljöer (SSH/CI) där PKCE-flödet inte kan öppna en webbläsare lokalt.
Implementation
src/plugin/device-flow.ts: RFC 8628 device authorization grant mot Keycloak─ or ─-divider mellan QR och fallback-länkurlsätts tillverification_uri_complete(user_code inbäddat) → opencode visar den highlighted ochckopierar denslow_down-backoff,expired_token- och timeout-hanteringqrcode-dependency tillagdTestat
auth.stage.berget.ai) och prod (auth.berget.ai)