Skip to content

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

Description

@BekaAbate

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions