Skip to content

Github copilot failing to authorize #8552

Closed

Description

@hamir-certain

Description

So I'm having issues authorizing opencode with github copilot, the authorization gets stopped very quickly.
I also had issues authenticating the gh cli with github so I suspect this is the same issue as:
cli/cli#9370

Since this is the issue I've had when using gh auth login, for gh cli it's possible to work around the issue as described in comments (basically by being quick and copying the code beforehand).
one solution is to have the challange code shown before you start pooling github.

with debug logs:

opencode auth login --log-level DEBUG --print-logs
INFO  2026-01-14T22:59:13 +235ms service=default version=1.1.20 args=["auth","login","--log-level","DEBUG","--print-logs"] opencode
INFO  2026-01-14T22:59:13 +0ms service=default directory=/home/osboxes/Documents/semaphore/semaphore creating instance
INFO  2026-01-14T22:59:13 +0ms service=project directory=/home/osboxes/Documents/semaphore/semaphore fromDirectory

┌  Add credential
INFO  2026-01-14T22:59:13 +17ms service=models.dev file={} refreshing
INFO  2026-01-14T22:59:13 +106ms service=config path=/home/osboxes/.config/opencode/config.json loading
INFO  2026-01-14T22:59:13 +0ms service=config path=/home/osboxes/.config/opencode/opencode.json loading
INFO  2026-01-14T22:59:13 +0ms service=config path=/home/osboxes/.config/opencode/opencode.jsonc loading
INFO  2026-01-14T22:59:13 +2ms service=bun cmd=["/home/osboxes/.opencode/bin/opencode","add","@opencode-ai/plugin@1.1.20","--exact"] cwd=/home/osboxes/.config/opencode running
DEBUG 2026-01-14T22:59:13 +1ms service=config loading config from /home/osboxes/.opencode/opencode.jsonc
INFO  2026-01-14T22:59:13 +0ms service=config path=/home/osboxes/.opencode/opencode.jsonc loading
DEBUG 2026-01-14T22:59:13 +1ms service=config loading config from /home/osboxes/.opencode/opencode.json
INFO  2026-01-14T22:59:13 +0ms service=config path=/home/osboxes/.opencode/opencode.json loading
INFO  2026-01-14T22:59:13 +0ms service=bun cmd=["/home/osboxes/.opencode/bin/opencode","add","@opencode-ai/plugin@1.1.20","--exact"] cwd=/home/osboxes/.opencode running
INFO  2026-01-14T22:59:13 +11ms service=models.dev file={} refreshing
INFO  2026-01-14T22:59:13 +1ms service=bun code=0 stdout=bun add v1.3.5 (1e86cebd)

installed @opencode-ai/plugin@1.1.20

[3.00ms] done
 stderr=Saved lockfile
 done
INFO  2026-01-14T22:59:13 +0ms service=bun cmd=["/home/osboxes/.opencode/bin/opencode","install"] cwd=/home/osboxes/.config/opencode running
INFO  2026-01-14T22:59:13 +0ms service=bun code=0 stdout=bun add v1.3.5 (1e86cebd)

installed @opencode-ai/plugin@1.1.20

[2.00ms] done
 stderr=Saved lockfile
 done
INFO  2026-01-14T22:59:13 +1ms service=bun cmd=["/home/osboxes/.opencode/bin/opencode","install"] cwd=/home/osboxes/.opencode running
│
◆  Select provider

│  Search: _
│  ● OpenCode Zen (recommended)
│  ○ Anthropic
│  ○ GitHub Copilot
│  ○ OpenAI
│  ○ Google
◇  Select provider
│  GitHub Copilot
INFO  2026-01-14T22:59:16 +2982ms service=plugin name=CodexAuthPlugin loading internal plugin
INFO  2026-01-14T22:59:16 +0ms service=plugin path=opencode-copilot-auth@0.0.12 loading plugin
INFO  2026-01-14T22:59:16 +3ms service=plugin path=opencode-anthropic-auth@0.0.8 loading plugin
INFO  2026-01-14T22:59:16 +16ms service=plugin path=@gitlab/opencode-gitlab-auth@1.3.0 loading plugin
│
◇  Select GitHub deployment type
│  GitHub.com
│
●  Go to: https://github.com/login/device
│
●  Enter code: A70D-8000
│
■  Failed to authorize
│
└  Done

Plugins

No response

OpenCode version

1.1.20

Steps to reproduce

I don't think this can be easily reproduced as it's environment specific. Guys over on cli/cli#9370 couldn't reproduce it

Screenshot and/or share link

No response

Operating System

Ubuntu 24.04 (vm on Windows host)

Terminal

Gnome Terminal

Activity

  1. github-actions commented on Jan 14, 2026

    @github-actions
    Contributor

    This issue appears to be unique in our repository - it's specifically about the device flow authorization timing out too quickly during GitHub Copilot authentication.

    While we don't have an exact duplicate, you may find the following related issues useful for context on GitHub Copilot authentication challenges:

    The core issue you're experiencing aligns with the gh CLI issue you referenced (cli/cli#9370), which suggests this might be an upstream GitHub API limitation or browser behavior related to the device flow timeout.

    If you're able to gather any additional environment-specific debugging information (browser logs, network timing, exact timeout duration), it would help in diagnosing whether this is a client-side or server-side timeout issue.

  2. rekram1-node commented on Jan 14, 2026

    @rekram1-node
    Contributor

    commenting so u know i saw this

  3. DennisLoska commented on Jan 15, 2026

    @DennisLoska

    Hey, also noticed this issue today:

    INFO  2026-01-15T17:03:29 +1714ms service=plugin name=CodexAuthPlugin loading internal plugin
    INFO  2026-01-15T17:03:29 +1ms service=plugin name=CopilotAuthPlugin loading internal plugin
    INFO  2026-01-15T17:03:29 +0ms service=plugin path=opencode-anthropic-auth@0.0.9 loading plugin
    INFO  2026-01-15T17:03:29 +30ms service=plugin path=@gitlab/opencode-gitlab-auth@1.3.0 loading plugin
    ERROR 2026-01-15T17:03:33 +3286ms service=default name=Error message=Failed to initiate device authorization stack=Error: Failed to initiate device authorization
        at authorize (src/plugin/copilot.ts:172:25)
        at processTicksAndRejections (native:7:39) fatal

    when running opencode auth login on 1.1.21, having Brave as default browser - could also be related to a Github API outage?

    https://www.githubstatus.com/

  4. rekram1-node commented on Jan 15, 2026

    @rekram1-node
    Contributor

    Is there anything special about your environment? Idk what is failing for u

  5. DennisLoska commented on Jan 15, 2026

    @DennisLoska

    Found it! So the problem was running the command within my tmux session! After detaching and trying it worked (same for gh cli btw`)!

  6. hamir-certain commented on Jan 15, 2026

    @hamir-certain
    Author

    Interesting, I'm using i3wm, but I really can't see how that can cause this

  7. rekram1-node commented on Jan 15, 2026

    @rekram1-node
    Contributor

    You can auth in tui btw,

    opencode

    then /connect

  8. hamir-certain commented on Jan 15, 2026

    @hamir-certain
    Author

    Yeah I've initially tried that, it just closes the overlay (I guess same error happens)

    opencode_copilot.mp4
  9. rekram1-node commented on Jan 15, 2026

    @rekram1-node
    Contributor

    hmmm

  10. hamir-certain commented on Jan 15, 2026

    @hamir-certain
    Author

    I'll try the new version of the gh cli ad they've released a version containing this fix cli/oauth@f0230b8
    If that works I'll try building opencode with a modified copilot plugin, handling the slow_down response might do the trick.

  11. hamir-certain commented on Jan 16, 2026

    @hamir-certain
    Author

    hey @rekram1-node I've made a PR that fixed this issue for me #8986

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions