Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
Loading