From 8ef17c221955b3442e3ae28eca6ab27c5e37f86b Mon Sep 17 00:00:00 2001 From: Jakob Karlstrand Date: Mon, 14 Sep 2026 10:45:24 +0200 Subject: [PATCH] docs: update README for device flow + current method names --- README.md | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 99faa15..456c07f 100644 --- a/README.md +++ b/README.md @@ -15,13 +15,24 @@ opencode ## Authentication Methods -### Berget Code (SSO) +### Berget Code Seat — Magic link -For team members with a Berget Code seat: +For team members with a Berget Code seat, on machines with a browser: 1. Run `/connect` in OpenCode -2. Select "Use Berget Code plan" -3. Authenticate in browser — token refresh is automatic +2. Select "Berget Code Seat - Magic link" +3. The login page opens in your browser — token refresh is automatic + +### Berget Code Seat — QR or device code + +For headless environments (SSH, CI, containers) where the browser cannot open on the same machine: + +1. Run `/connect` in OpenCode +2. Select "Berget Code Seat - QR or device code" +3. Scan the QR code with your phone, or open the link shown in the dialog — the sign-in code is already included in it +4. Approve the sign-in on the other device; OpenCode continues automatically + +The sign-in is valid for 10 minutes. If it times out, just run `/connect` again. ### API Key @@ -33,7 +44,8 @@ For API key users: ## How It Works -- **PKCE Authorization Flow** for SSO login +- **PKCE Authorization Flow** for browser login (magic link) +- **Device Authorization Grant** ([RFC 8628](https://datatracker.ietf.org/doc/html/rfc8628)) for QR / device code login on headless machines - **Automatic token refresh** via custom fetch — sessions stay alive indefinitely - **Models fetched dynamically** from Berget API — no manual config needed