Skip to content

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

Closed as not planned

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

Activity

  1. github-actions commented on Aug 2, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of an existing issue. Please check:

    If your issue is not resolved by the fix in #35145 or you're experiencing it on a different version, please mention that so maintainers can track it separately.

  2. BekaAbate commented on Aug 2, 2026

    @BekaAbate
    Author

    the issue was not resolved with this: #35145, it was rejected because it doesnt meet the contribution guidlines.

  3. rekram1-node commented on Aug 7, 2026

    @rekram1-node
    Collaborator

    i cannot reproduce, plz provide more info? Seems specific to your setup this isnt being widely reported.

  4. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    Thanks for the detailed report, @BekaAbate!

    You're on OpenCode 1.18.11, which is v1. v1 now only gets fixes for critical bugs (data loss, security problems, or breakage with no workaround). Being asked to log in again each session is a real annoyance, but logging in does work, so this is unlikely to be fixed in v1.

    On your two observations: for GitHub Copilot, v1 normally stores the GitHub OAuth token (gho_…) as both access and refresh, with expires: 0, because that token has no fixed expiry. So the auth.json contents are probably expected and not the cause of the prompt.

    We'd encourage you to try OpenCode v2 (npm package @opencode/cli, command opencode), which is where active development happens. If the re-auth prompt also happens on v2, or you think this is critical, please reply here with your v2 version and the exact prompt or message you see.

    Possibly related:

  5. opencodejr commented on Oct 29, 2026

    @opencodejr
    Contributor

    Closing this as not planned, @BekaAbate. The Copilot re-auth prompt was reported on v1 (1.18.11), and v1 now only gets fixes for critical bugs. Logging in again does work, so this isn't critical. As mentioned above, the auth.json contents (expires: 0, same access and refresh) are probably normal for Copilot in v1.

    If you try OpenCode v2 (@opencode/cli) and still get asked to log in every session, please open a new issue with your v2 version and the exact prompt you see, and link back to this one. Thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions