anomalyco / anomalyco/opencode

Copilot re-auth prompted every session despite stored credential — expires:0, refresh == access

Open
#40,183 3 comments 0 reactions 1 assignee View on GitHub

@rekram1-node is already working on this.

Since Aug 2, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

After completing the GitHub Copilot device-code login successfully(the student package), opencode still
prompts to reauthenticate on every new session, even though opencode auth list shows
a credential is stored.

Steps to reproduce
  1. opencode auth login → GitHub Copilot → GitHub.com → complete device code flow
  2. opencode auth list confirms a credential exists
  3. Close and reopen opencode (or start a new session) → prompted to reauth again
Observation

Contents of ~/.local/share/opencode/auth.json after a fresh login:

{
  "github-copilot": {
    "type": "oauth",
    "access": "gho_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "refresh": "gho_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "expires": 0
  }
}

Two things stand out that may or may not be related to the reauth prompts:

  • expires is 0 right after a successful login
  • access and refresh have identical values

Not sure if this is expected behavior for how Copilot's device flow issues tokens, or a
storage bug — flagging in case it's useful for reproducing the reauth issue.

Environment
  • OpenCode version: [1.18.11]
  • OS: Linux(ubuntu 24.04 LTS)
  • Shell: fish
    -terminal-emulator: alacritty
  • Auth: GitHub Copilot, device code flow, GitHub.com

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.