Github Enterprise authorization #2607

Open
opened 2026-02-16 17:36:25 -05:00 by yindo · 35 comments
Owner

Originally created by @rdentato on GitHub (Nov 5, 2025).

Originally assigned to: @rekram1-node on GitHub.

Description

Got an Unexpected Error while trying to login with a Github Enterprise login:

┌  Add credential
│
◇  Select provider
│  GitHub Copilot
│
◇  Select GitHub deployment type
│  GitHub Enterprise
│
◇  Enter your GitHub Enterprise URL or domain
│  https://github.my-company-domain.com
Error: Unexpected error, check log file at /home/remo/.local/share/opencode/log/2025-11-05T113425.log for more details

192 |                 scope: "read:user",
193 |               }),
194 |             });
195 |
196 |             if (!deviceResponse.ok) {
197 |               throw new Error("Failed to initiate device authorization");
                              ^
error: Failed to initiate device authorization
      at authorize (/home/remo/.cache/opencode/node_modules/opencode-copilot-auth/index.mjs:197:25)
      at processTicksAndRejections (native:7:39)

I can login to my company Github via web just fine. The actual name of the company has been hidden for privacy reason.

The last lines of the log file are:

INFO  2025-11-05T11:34:27 +5ms service=plugin path=opencode-copilot-auth@0.0.4 loading plugin
INFO  2025-11-05T11:34:27 +15ms service=plugin path=opencode-anthropic-auth@0.0.2 loading plugin
ERROR 2025-11-05T11:34:44 +17640ms service=default name=Error message=Failed to initiate device authorization stack=Error: Failed to initiate device authorization
    at authorize (/home/remo/.cache/opencode/node_modules/opencode-copilot-auth/index.mjs:197:25)
    at processTicksAndRejections (native:7:39) fatal

OpenCode version

10.0.25

Steps to reproduce

  1. run "opencode auth login"
  2. choose "Github Copilot"
  3. choose "GitHub Enterprise"
  4. enter the doain name "https://github.my-company-domain.com" (actual domain hidden for privacy reasons)

Screenshot and/or share link

No response

Operating System

Windows 11 + WSL2 Ubuntu 24.04

Terminal

Windows Terminal

Originally created by @rdentato on GitHub (Nov 5, 2025). Originally assigned to: @rekram1-node on GitHub. ### Description Got an Unexpected Error while trying to login with a Github Enterprise login: ``` ┌ Add credential │ ◇ Select provider │ GitHub Copilot │ ◇ Select GitHub deployment type │ GitHub Enterprise │ ◇ Enter your GitHub Enterprise URL or domain │ https://github.my-company-domain.com Error: Unexpected error, check log file at /home/remo/.local/share/opencode/log/2025-11-05T113425.log for more details 192 | scope: "read:user", 193 | }), 194 | }); 195 | 196 | if (!deviceResponse.ok) { 197 | throw new Error("Failed to initiate device authorization"); ^ error: Failed to initiate device authorization at authorize (/home/remo/.cache/opencode/node_modules/opencode-copilot-auth/index.mjs:197:25) at processTicksAndRejections (native:7:39) ``` I can login to my company Github via web just fine. The actual name of the company has been hidden for privacy reason. The last lines of the log file are: ``` INFO 2025-11-05T11:34:27 +5ms service=plugin path=opencode-copilot-auth@0.0.4 loading plugin INFO 2025-11-05T11:34:27 +15ms service=plugin path=opencode-anthropic-auth@0.0.2 loading plugin ERROR 2025-11-05T11:34:44 +17640ms service=default name=Error message=Failed to initiate device authorization stack=Error: Failed to initiate device authorization at authorize (/home/remo/.cache/opencode/node_modules/opencode-copilot-auth/index.mjs:197:25) at processTicksAndRejections (native:7:39) fatal ``` ### OpenCode version 10.0.25 ### Steps to reproduce 1. run "opencode auth login" 2. choose "Github Copilot" 3. choose "GitHub Enterprise" 4. enter the doain name "https://github.my-company-domain.com" (actual domain hidden for privacy reasons) ### Screenshot and/or share link _No response_ ### Operating System Windows 11 + WSL2 Ubuntu 24.04 ### Terminal Windows Terminal
yindo added the bug label 2026-02-16 17:36:25 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Nov 5, 2025):

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

  • #664: Support Github Copilot Enterprise provider - specifically addresses the lack of GitHub Enterprise support for Copilot authentication
  • #355: enhancement: support ghe.com copilot auth - requests support for GitHub Enterprise Copilot auth

Both of these existing issues highlight that OpenCode currently only supports Copilot auth using the standard github.com domain, which appears to be the root cause of your "Failed to initiate device authorization" error when trying to use your GitHub Enterprise domain.

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Nov 5, 2025): This issue might be a duplicate of existing issues. Please check: - #664: Support Github Copilot Enterprise provider - specifically addresses the lack of GitHub Enterprise support for Copilot authentication - #355: enhancement: support ghe.com copilot auth - requests support for GitHub Enterprise Copilot auth Both of these existing issues highlight that OpenCode currently only supports Copilot auth using the standard github.com domain, which appears to be the root cause of your "Failed to initiate device authorization" error when trying to use your GitHub Enterprise domain. Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Nov 5, 2025):

i would need to have a second glance at rhe code, but for domain name are you including an https prefix? I think it is looking just for the domain name not the url

@rekram1-node commented on GitHub (Nov 5, 2025): i would need to have a second glance at rhe code, but for domain name are you including an https prefix? I think it is looking just for the domain name not the url
Author
Owner

@rdentato commented on GitHub (Nov 5, 2025):

I tried with:

I access my company GitHub with: https://github.my-company.com and I checked that the htts:://github.my-company.com/login/device works properly.

The URL copilot-api.github.my-company.com and api.github.my-company.com do NOT work (not sure if they should, I just checked).
The URL https://api.my-company.ghe.com/ returns "Couldn't find Business with slug = my-company"

@rdentato commented on GitHub (Nov 5, 2025): I tried with: - https://github.my-company.com - github.my-company.com - my-company.ghe.com - my-company.com - my-company I access my company GitHub with: https://github.my-company.com and I checked that the htts:://github.my-company.com/login/device works properly. The URL copilot-api.github.my-company.com and api.github.my-company.com do NOT work (not sure if they should, I just checked). The URL https://api.my-company.ghe.com/ returns "Couldn't find Business with slug = my-company"
Author
Owner

@rekram1-node commented on GitHub (Nov 10, 2025):

Im gonna fix this today Ik the bug

@rekram1-node commented on GitHub (Nov 10, 2025): Im gonna fix this today Ik the bug
Author
Owner

@rdentato commented on GitHub (Nov 12, 2025):

Great! In the meantime I noticed that I can login to github.com using my company name: "name-surname_cmpny"
the "_cmpny" at the end triggers the SSO with my company and I can login exactly as I had used "https://github.cmpny.com/"
Maybe is a different type of integration than having a "ghe.com" name?

@rdentato commented on GitHub (Nov 12, 2025): Great! In the meantime I noticed that I can login to github.com using my company name: "name-surname_cmpny" the "_cmpny" at the end triggers the SSO with my company and I can login exactly as I had used "https://github.cmpny.com/" Maybe is a different type of integration than having a "ghe.com" name?
Author
Owner

@rekram1-node commented on GitHub (Nov 12, 2025):

yeah i think ur right

@rekram1-node commented on GitHub (Nov 12, 2025): yeah i think ur right
Author
Owner

@jolo-dev commented on GitHub (Jan 3, 2026):

Any progress on this? I am facing the same issue!

@jolo-dev commented on GitHub (Jan 3, 2026): Any progress on this? I am facing the same issue!
Author
Owner

@maaaark commented on GitHub (Jan 15, 2026):

I am having the same issue login to ghe.com..
Also there is no way to login the ghe.com in the GUI right? Only by TUI?

Here is the auth with logs:

` opencode --print-logs auth login
INFO 2026-01-15T18:29:01 +202ms service=default version=1.1.22 args=["--print-logs","auth","login"] opencode
INFO 2026-01-15T18:29:01 +0ms service=default directory=D:\web\trails creating instance
INFO 2026-01-15T18:29:01 +0ms service=project directory=D:\web\trails fromDirectory

┌ Add credential
INFO 2026-01-15T18:29:01 +31ms service=models.dev file={} refreshing
INFO 2026-01-15T18:29:02 +163ms service=config path=C:\Users\markt.config\opencode\config.json loading
INFO 2026-01-15T18:29:02 +0ms service=config path=C:\Users\markt.config\opencode\opencode.json loading
INFO 2026-01-15T18:29:02 +0ms service=config path=C:\Users\markt.config\opencode\opencode.jsonc loading
INFO 2026-01-15T18:29:02 +3ms service=bun cmd=["C:\Users\markt\AppData\Roaming\npm\node_modules\opencode-ai\node_modules\opencode-windows-x64\bin\opencode.exe","add","@opencode-ai/plugin@1.1.22","--exact"] cwd=C:\Users\markt.config\opencode running
INFO 2026-01-15T18:29:02 +10ms service=models.dev file={} refreshing

◆ Select provider

│ Search: _
│ ● OpenCode Zen (recommended)
│ ○ Anthropic
│ ○ GitHub Copilot
│ ○ OpenAI
│ ○ Google
│ ○ OpenRouter
│ ○ Vercel AI Gateway
│ ...
◇ Select provider
│ GitHub Copilot
INFO 2026-01-15T18:29:31 +29545ms service=plugin name=CodexAuthPlugin loading internal plugin
INFO 2026-01-15T18:29:31 +0ms service=plugin name=CopilotAuthPlugin loading internal plugin
INFO 2026-01-15T18:29:31 +0ms service=plugin path=opencode-anthropic-auth@0.0.9 loading plugin
INFO 2026-01-15T18:29:31 +21ms service=plugin path=@gitlab/opencode-gitlab-auth@1.3.0 loading plugin

◇ Select GitHub deployment type
│ GitHub Enterprise

◇ Enter your GitHub Enterprise URL or domain
https://XXXXXXXXXXX.ghe.com
ERROR 2026-01-15T18:29:54 +22115ms 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
Error: Unexpected error, check log file at for more details

Failed to initiate device authorization`

Any help or hint would be nice :)

@maaaark commented on GitHub (Jan 15, 2026): I am having the same issue login to ghe.com.. Also there is no way to login the ghe.com in the GUI right? Only by TUI? **Here is the auth with logs:** ` opencode --print-logs auth login INFO 2026-01-15T18:29:01 +202ms service=default version=1.1.22 args=["--print-logs","auth","login"] opencode INFO 2026-01-15T18:29:01 +0ms service=default directory=D:\web\trails creating instance INFO 2026-01-15T18:29:01 +0ms service=project directory=D:\web\trails fromDirectory ┌ Add credential INFO 2026-01-15T18:29:01 +31ms service=models.dev file={} refreshing INFO 2026-01-15T18:29:02 +163ms service=config path=C:\Users\markt\.config\opencode\config.json loading INFO 2026-01-15T18:29:02 +0ms service=config path=C:\Users\markt\.config\opencode\opencode.json loading INFO 2026-01-15T18:29:02 +0ms service=config path=C:\Users\markt\.config\opencode\opencode.jsonc loading INFO 2026-01-15T18:29:02 +3ms service=bun cmd=["C:\\Users\\markt\\AppData\\Roaming\\npm\\node_modules\\opencode-ai\\node_modules\\opencode-windows-x64\\bin\\opencode.exe","add","@opencode-ai/plugin@1.1.22","--exact"] cwd=C:\Users\markt\.config\opencode running INFO 2026-01-15T18:29:02 +10ms service=models.dev file={} refreshing │ ◆ Select provider │ Search: _ │ ● OpenCode Zen (recommended) │ ○ Anthropic │ ○ GitHub Copilot │ ○ OpenAI │ ○ Google │ ○ OpenRouter │ ○ Vercel AI Gateway │ ... ◇ Select provider │ GitHub Copilot INFO 2026-01-15T18:29:31 +29545ms service=plugin name=CodexAuthPlugin loading internal plugin INFO 2026-01-15T18:29:31 +0ms service=plugin name=CopilotAuthPlugin loading internal plugin INFO 2026-01-15T18:29:31 +0ms service=plugin path=opencode-anthropic-auth@0.0.9 loading plugin INFO 2026-01-15T18:29:31 +21ms service=plugin path=@gitlab/opencode-gitlab-auth@1.3.0 loading plugin │ ◇ Select GitHub deployment type │ GitHub Enterprise │ ◇ Enter your GitHub Enterprise URL or domain │ https://XXXXXXXXXXX.ghe.com ERROR 2026-01-15T18:29:54 +22115ms 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 Error: Unexpected error, check log file at for more details Failed to initiate device authorization` Any help or hint would be nice :)
Author
Owner

@rekram1-node commented on GitHub (Jan 15, 2026):

working w/ copilot team to get this figured out

@rekram1-node commented on GitHub (Jan 15, 2026): working w/ copilot team to get this figured out
Author
Owner

@0xOliver commented on GitHub (Jan 16, 2026):

I notice that the endpoints are different:

My github enterprise does not have the /login/device/code endpoint (I get a 404).

@0xOliver commented on GitHub (Jan 16, 2026): I notice that the endpoints are different: - non-enterprise: https://github.com/login/device - enterprise: https://${domain}/login/device/code [src/plugin/copilot.ts#L13](https://github.com/anomalyco/opencode/blob/524ea95a00efd0dff367c4ef9d285f291d54cbf0/packages/opencode/src/plugin/copilot.ts#L13) My github enterprise does not have the /login/device/code endpoint (I get a 404).
Author
Owner

@vmagalhaes commented on GitHub (Jan 16, 2026):

I notice that the endpoints are different:

My github enterprise does not have the /login/device/code endpoint (I get a 404).

Same in my side. Can't use the github enterprise, will be really useful if we can.

Checked 3 installs across 4 packages (no changes) [5.00ms] stderr= done INFO 2026-01-16T09:51:22 +2158ms service=plugin name=CodexAuthPlugin loading internal plugin INFO 2026-01-16T09:51:22 +0ms service=plugin name=CopilotAuthPlugin loading internal plugin INFO 2026-01-16T09:51:22 +0ms service=plugin path=opencode-anthropic-auth@0.0.9 loading plugin INFO 2026-01-16T09:51:23 +58ms service=plugin path=@gitlab/opencode-gitlab-auth@1.3.0 loading plugin ERROR 2026-01-16T09:51:30 +7332ms 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

cc: @rekram1-node

@vmagalhaes commented on GitHub (Jan 16, 2026): > I notice that the endpoints are different: > > * non-enterprise: https://github.com/login/device > * enterprise: https://${domain}/login/device/code [src/plugin/copilot.ts#L13](https://github.com/anomalyco/opencode/blob/524ea95a00efd0dff367c4ef9d285f291d54cbf0/packages/opencode/src/plugin/copilot.ts#L13) > > My github enterprise does not have the /login/device/code endpoint (I get a 404). Same in my side. Can't use the github enterprise, will be really useful if we can. `Checked 3 installs across 4 packages (no changes) [5.00ms] stderr= done INFO 2026-01-16T09:51:22 +2158ms service=plugin name=CodexAuthPlugin loading internal plugin INFO 2026-01-16T09:51:22 +0ms service=plugin name=CopilotAuthPlugin loading internal plugin INFO 2026-01-16T09:51:22 +0ms service=plugin path=opencode-anthropic-auth@0.0.9 loading plugin INFO 2026-01-16T09:51:23 +58ms service=plugin path=@gitlab/opencode-gitlab-auth@1.3.0 loading plugin ERROR 2026-01-16T09:51:30 +7332ms 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` cc: @rekram1-node
Author
Owner

@Raviguntakala commented on GitHub (Jan 18, 2026):

working w/ copilot team to get this figured out

Changing the client ID from Ov23li8tweQw6odWQebz to Iv1.b507a08c87ecfe98 makes enterprise authentication work for me

@Raviguntakala commented on GitHub (Jan 18, 2026): > working w/ copilot team to get this figured out Changing the client ID from Ov23li8tweQw6odWQebz to Iv1.b507a08c87ecfe98 makes enterprise authentication work for me
Author
Owner

@jorgedanoz-cegedim commented on GitHub (Jan 19, 2026):

Same issue here @rekram1-node, exactly as @vmagalhaes described.
Do you have any estimate for a fix?
Thank you

@jorgedanoz-cegedim commented on GitHub (Jan 19, 2026): Same issue here @rekram1-node, exactly as @vmagalhaes described. Do you have any estimate for a fix? Thank you
Author
Owner

@vmagalhaes commented on GitHub (Jan 19, 2026):

Same issue here @rekram1-node, exactly as @vmagalhaes described. Do you have any estimate for a fix? Thank you

A possible workaround is installing the version 1.1.9 (via npm|the enterprise still work), login, then upgrade to 1.1.25.

@vmagalhaes commented on GitHub (Jan 19, 2026): > Same issue here [@rekram1-node](https://github.com/rekram1-node), exactly as [@vmagalhaes](https://github.com/vmagalhaes) described. Do you have any estimate for a fix? Thank you A possible workaround is installing the version 1.1.9 (via npm|the enterprise still work), login, then upgrade to 1.1.25.
Author
Owner

@jorgedanoz-cegedim commented on GitHub (Jan 19, 2026):

@vmagalhaes that worked! thank you! Will wait for the fix.

@jorgedanoz-cegedim commented on GitHub (Jan 19, 2026): @vmagalhaes that worked! thank you! Will wait for the fix.
Author
Owner

@jorgedanoz-cegedim commented on GitHub (Jan 19, 2026):

I had to start opencode with this ENV VAR, in order to prevent the auto-update:

export OPENCODE_DISABLE_AUTOUPDATE=true
opencode

@jorgedanoz-cegedim commented on GitHub (Jan 19, 2026): I had to start opencode with this ENV VAR, in order to prevent the auto-update: export OPENCODE_DISABLE_AUTOUPDATE=true opencode
Author
Owner

@jorgedanoz-cegedim commented on GitHub (Jan 20, 2026):

@vmagalhaes if I upgrade to 1.1.25 it does fail again.
This is the reason I use the ENV VAR export OPENCODE_DISABLE_AUTOUPDATE=true, in order to stick/pin to 1.1.9, until the fix is ready in a new release.

@jorgedanoz-cegedim commented on GitHub (Jan 20, 2026): @vmagalhaes if I upgrade to 1.1.25 it does fail again. This is the reason I use the ENV VAR export OPENCODE_DISABLE_AUTOUPDATE=true, in order to stick/pin to 1.1.9, until the fix is ready in a new release.
Author
Owner

@jKm00 commented on GitHub (Jan 22, 2026):

I pinned it down to version 1.1.21, which breaks the enterprise authorization. So downgrading to 1.1.20 fixed it for me. Had to use the same env var as @jorgedanoz-cegedim to make sure it does not autoupdate to latest version...

@jKm00 commented on GitHub (Jan 22, 2026): I pinned it down to version 1.1.21, which breaks the enterprise authorization. So downgrading to 1.1.20 fixed it for me. Had to use the same env var as @jorgedanoz-cegedim to make sure it does not autoupdate to latest version...
Author
Owner

@jKm00 commented on GitHub (Jan 23, 2026):

Realized you can also disable autoupdate via the opencode config: https://opencode.ai/docs/config/#autoupdate

@jKm00 commented on GitHub (Jan 23, 2026): Realized you can also disable autoupdate via the opencode config: https://opencode.ai/docs/config/#autoupdate
Author
Owner

@jorgedanoz-cegedim commented on GitHub (Jan 23, 2026):

@jKm00 in my case with 1.1.9 that "autoupdate" config setting was not available, but I'll use 1.1.20 with "autoupdate". Thank you @jKm00

@jorgedanoz-cegedim commented on GitHub (Jan 23, 2026): @jKm00 in my case with 1.1.9 that "autoupdate" config setting was not available, but I'll use 1.1.20 with "autoupdate". Thank you @jKm00
Author
Owner

@felixscherz commented on GitHub (Jan 25, 2026):

I did use git bisect to find that d78d31430d introduced the issue.
This is where the client ID changed like @Raviguntakala suggested:

working w/ copilot team to get this figured out

Changing the client ID from Ov23li8tweQw6odWQebz to Iv1.b507a08c87ecfe98 makes enterprise authentication work for me

@felixscherz commented on GitHub (Jan 25, 2026): I did use `git bisect` to find that d78d31430d6aa221272fee8da5b96089cc9af105 introduced the issue. This is where the client ID changed like @Raviguntakala suggested: > > working w/ copilot team to get this figured out > > Changing the client ID from Ov23li8tweQw6odWQebz to Iv1.b507a08c87ecfe98 makes enterprise authentication work for me
Author
Owner

@jtyr commented on GitHub (Feb 3, 2026):

I couldn't figure out how to add the "OpenCode" OAuth App (ID: Ov23li8tweQw6odWQebz, owned by anomalyco, source) into our ghe.com instance which is the reason why the enterprise authentication fails as it cannot find such app:

curl -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'User-Agent: opencode/1.1.48' -d '{"client_id": "Ov23li8tweQw6odWQebz", "scope": "read:user"}' https://<company>.ghe.com/login/device/code
{"error":"Not Found"}

It works normally on github.com:

curl -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'User-Agent: opencode/1.1.48' -d '{"client_id": "Ov23li8tweQw6odWQebz", "scope": "read:user"}' https://github.com/login/device/code
{"device_code":"8399591e066cff97cff1b5bdcf19ad1ff75ec159","user_code":"1B99-C1CE","verification_uri":"https://github.com/login/device","expires_in":899,"interval":5}

But I tried to use the "GitHub Copilot CLI" OAuth App (ID: Ov23ctDVkRmgkPke0Mmm, owned by github-enterprise), which was added by using Copilot CLI, and that worked:

curl -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'User-Agent: opencode/1.1.48' -d '{"client_id": "Ov23ctDVkRmgkPke0Mmm", "scope": "read:user"}' https://<company>.ghe.com/login/device/code
{"device_code":"5824e5f33a2f6248dc2f5eda448fc0b0db4289d3","user_code":"3098-BB5E","verification_uri":"https://<company>.ghe.com/login/device","expires_in":899,"interval":5}

So I got an idea to try to hardcode the "GitHub Copilot CLI" OAuth App (ID: Ov23ctDVkRmgkPke0Mmm) into the code of OpenCode and try to run the authentication like that (make sure you have bun installed):

# Get the source code of OpenCode
git clone https://github.com/anomalyco/opencode.git 
cd opencode
# Patch the App ID
sed -i 's/Ov23li8tweQw6odWQebz/Ov23ctDVkRmgkPke0Mmm/' ./packages/opencode/src/plugin/copilot.ts
# Install dependencies
bun install
# Run the Copilot authentication for your ghe.com
bun dev auth login

And that worked! Then you can run the normal upstream OpenCode and it keeps working.

Btw. the above suggested App ID Iv1.b507a08c87ecfe98 is for "GitHub Copilot Plugin" (owned by github-enterprise) which is a normal GitHub App and not OAuth App. The above process works with this ID as well:

curl -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'User-Agent: opencode/1.1.48' -d '{"client_id": "Iv1.b507a08c87ecfe98", "scope": "read:user"}' https://<company>.ghe.com/login/device/code
{"device_code":"56c5bc8f8d9007631302951648e0eb6609809181","user_code":"3AD0-872C","verification_uri":"https://<company>.ghe.com/login/device","expires_in":899,"interval":5}

I think that unless there is a way how to add the "OpenCode" OAuth App (ID: Ov23li8tweQw6odWQebz, owned by anomalyco) into the ghe.com instance, or unless OpenCode makes a deal with GitHub to whitelist their OAuth App, we will need to use some OAuth/GitHub App owned by github-enterprise as a workaround.

@jtyr commented on GitHub (Feb 3, 2026): I couldn't figure out how to add the "_OpenCode_" OAuth App (ID: `Ov23li8tweQw6odWQebz`, owned by `anomalyco`, [source](https://github.com/anomalyco/opencode/blob/dev/packages/opencode/src/plugin/copilot.ts#L5)) into our ghe.com instance which is the reason why the enterprise authentication fails as it cannot find such app: ```bash curl -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'User-Agent: opencode/1.1.48' -d '{"client_id": "Ov23li8tweQw6odWQebz", "scope": "read:user"}' https://<company>.ghe.com/login/device/code {"error":"Not Found"} ``` It works normally on github.com: ```bash curl -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'User-Agent: opencode/1.1.48' -d '{"client_id": "Ov23li8tweQw6odWQebz", "scope": "read:user"}' https://github.com/login/device/code {"device_code":"8399591e066cff97cff1b5bdcf19ad1ff75ec159","user_code":"1B99-C1CE","verification_uri":"https://github.com/login/device","expires_in":899,"interval":5} ``` But I tried to use the "_GitHub Copilot CLI_" OAuth App (ID: `Ov23ctDVkRmgkPke0Mmm`, owned by `github-enterprise`), which was added by using [Copilot CLI](https://github.com/features/copilot/cli), and that worked: ```bash curl -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'User-Agent: opencode/1.1.48' -d '{"client_id": "Ov23ctDVkRmgkPke0Mmm", "scope": "read:user"}' https://<company>.ghe.com/login/device/code {"device_code":"5824e5f33a2f6248dc2f5eda448fc0b0db4289d3","user_code":"3098-BB5E","verification_uri":"https://<company>.ghe.com/login/device","expires_in":899,"interval":5} ``` So I got an idea to try to hardcode the "_GitHub Copilot CLI_" OAuth App (ID: `Ov23ctDVkRmgkPke0Mmm`) into the code of OpenCode and try to run the authentication like that (make sure you have `bun` installed): ```bash # Get the source code of OpenCode git clone https://github.com/anomalyco/opencode.git cd opencode # Patch the App ID sed -i 's/Ov23li8tweQw6odWQebz/Ov23ctDVkRmgkPke0Mmm/' ./packages/opencode/src/plugin/copilot.ts # Install dependencies bun install # Run the Copilot authentication for your ghe.com bun dev auth login ``` And that worked! Then you can run the normal upstream OpenCode and it keeps working. Btw. the above suggested App ID `Iv1.b507a08c87ecfe98` is for "_GitHub Copilot Plugin_" (owned by `github-enterprise`) which is a normal GitHub App and not OAuth App. The above process works with this ID as well: ```bash curl -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'User-Agent: opencode/1.1.48' -d '{"client_id": "Iv1.b507a08c87ecfe98", "scope": "read:user"}' https://<company>.ghe.com/login/device/code {"device_code":"56c5bc8f8d9007631302951648e0eb6609809181","user_code":"3AD0-872C","verification_uri":"https://<company>.ghe.com/login/device","expires_in":899,"interval":5} ``` I think that unless there is a way how to add the "_OpenCode_" OAuth App (ID: `Ov23li8tweQw6odWQebz`, owned by `anomalyco`) into the ghe.com instance, or unless OpenCode makes a deal with GitHub to whitelist their OAuth App, we will need to use some OAuth/GitHub App owned by `github-enterprise` as a workaround.
Author
Owner

@danriedl commented on GitHub (Feb 3, 2026):

@jtyr great! this solves the auth login aswell as the Error: The requested model is not supported. problem.

@danriedl commented on GitHub (Feb 3, 2026): @jtyr great! this solves the `auth login` aswell as the `Error: The requested model is not supported.` problem.
Author
Owner

@rekram1-node commented on GitHub (Feb 3, 2026):

Yeah we have to go through a process to get github enterprise added, it is straight forward just has some paper work and approvals

@rekram1-node commented on GitHub (Feb 3, 2026): Yeah we have to go through a process to get github enterprise added, it is straight forward just has some paper work and approvals
Author
Owner

@danriedl commented on GitHub (Feb 4, 2026):

We need to go through a process to get GitHub Enterprise added. It’s straightforward, but it does involve some paperwork and approvals.

@rekram1-node I also don’t really understand why this change is being introduced in new versions when there’s still outstanding paperwork (dependencies) blocking GitHub Enterprise. But thanks that you're working on that - really appreciated!

@danriedl commented on GitHub (Feb 4, 2026): > We need to go through a process to get GitHub Enterprise added. It’s straightforward, but it does involve some paperwork and approvals. @rekram1-node I also don’t really understand why this change is being introduced in new versions when there’s still outstanding paperwork (dependencies) blocking GitHub Enterprise. But thanks that you're working on that - really appreciated!
Author
Owner

@danriedl commented on GitHub (Feb 10, 2026):

@jtyr patching the binary directly works perfectly, as the replacement Client ID has the exact same length.

MacOS (Homebrew):
Requires re-signing the binary to avoid zsh: killed.

# Locate the actual binary inside the Cellar
OPENCODE_BINARY=$(find /opt/homebrew -path "*/opencode-darwin-*/bin/opencode" -type f 2>/dev/null | head -n 1)

# Patch the ID
perl -pi -e 's/Ov23li8tweQw6odWQebz/Ov23ctDVkRmgkPke0Mmm/g' "$OPENCODE_BINARY"

# Re-sign the binary (Crucial on macOS!)
sudo codesign --force --deep --sign - "$OPENCODE_BINARY"

Linux (Homebrew / Linuxbrew):
Same process, but no code signing required.

# Locate the binary (Standard Linuxbrew path)
OPENCODE_BINARY=$(find /home/linuxbrew/.linuxbrew -path "*/opencode-linux-*/bin/opencode" -type f 2>/dev/null | head -n 1)

# Patch the ID
perl -pi -e 's/Ov23li8tweQw6odWQebz/Ov23ctDVkRmgkPke0Mmm/g' "$OPENCODE_BINARY"

@danriedl commented on GitHub (Feb 10, 2026): @jtyr patching the binary directly works perfectly, as the replacement Client ID has the exact same length. **MacOS (Homebrew):** Requires re-signing the binary to avoid `zsh: killed`. ```bash # Locate the actual binary inside the Cellar OPENCODE_BINARY=$(find /opt/homebrew -path "*/opencode-darwin-*/bin/opencode" -type f 2>/dev/null | head -n 1) # Patch the ID perl -pi -e 's/Ov23li8tweQw6odWQebz/Ov23ctDVkRmgkPke0Mmm/g' "$OPENCODE_BINARY" # Re-sign the binary (Crucial on macOS!) sudo codesign --force --deep --sign - "$OPENCODE_BINARY" ``` **Linux (Homebrew / Linuxbrew):** Same process, but no code signing required. ```bash # Locate the binary (Standard Linuxbrew path) OPENCODE_BINARY=$(find /home/linuxbrew/.linuxbrew -path "*/opencode-linux-*/bin/opencode" -type f 2>/dev/null | head -n 1) # Patch the ID perl -pi -e 's/Ov23li8tweQw6odWQebz/Ov23ctDVkRmgkPke0Mmm/g' "$OPENCODE_BINARY" ```
Author
Owner

@dotned commented on GitHub (Feb 11, 2026):

We need to go through a process to get GitHub Enterprise added. It’s straightforward, but it does involve some paperwork and approvals.

@rekram1-node I also don’t really understand why this change is being introduced in new versions when there’s still outstanding paperwork (dependencies) blocking GitHub Enterprise. But thanks that you're working on that - really appreciated!

Has there been any movement on this? I'm having to anchor to version 1.1.20 and watch the latest hit over 50. I understand and support the idea this should be done correctly against an official GH OAuth app but breaking the GHE.com users in doing so has meant stalling recommending it internally. As a GHE enterprise customer would a ticket in to GH help, happy to apply any pressure to move this forward if it can help.

@dotned commented on GitHub (Feb 11, 2026): > > We need to go through a process to get GitHub Enterprise added. It’s straightforward, but it does involve some paperwork and approvals. > > [@rekram1-node](https://github.com/rekram1-node) I also don’t really understand why this change is being introduced in new versions when there’s still outstanding paperwork (dependencies) blocking GitHub Enterprise. But thanks that you're working on that - really appreciated! Has there been any movement on this? I'm having to anchor to version 1.1.20 and watch the latest hit over 50. I understand and support the idea this should be done correctly against an official GH OAuth app but breaking the GHE.com users in doing so has meant stalling recommending it internally. As a GHE enterprise customer would a ticket in to GH help, happy to apply any pressure to move this forward if it can help.
Author
Owner

@dotned commented on GitHub (Feb 12, 2026):

We need to go through a process to get GitHub Enterprise added. It’s straightforward, but it does involve some paperwork and approvals.

@rekram1-node I also don’t really understand why this change is being introduced in new versions when there’s still outstanding paperwork (dependencies) blocking GitHub Enterprise. But thanks that you're working on that - really appreciated!

Has there been any movement on this? I'm having to anchor to version 1.1.20 and watch the latest hit over 50. I understand and support the idea this should be done correctly against an official GH OAuth app but breaking the GHE.com users in doing so has meant stalling recommending it internally. As a GHE enterprise customer would a ticket in to GH help, happy to apply any pressure to move this forward if it can help.

For what it is worth I have raised a ticket for our GHE instance quoting MS's own blog post supporting OpenCode, and not mentioning any limitation to just GH.com. I'll share any response.

@dotned commented on GitHub (Feb 12, 2026): > > > We need to go through a process to get GitHub Enterprise added. It’s straightforward, but it does involve some paperwork and approvals. > > > > > > [@rekram1-node](https://github.com/rekram1-node) I also don’t really understand why this change is being introduced in new versions when there’s still outstanding paperwork (dependencies) blocking GitHub Enterprise. But thanks that you're working on that - really appreciated! > > Has there been any movement on this? I'm having to anchor to version 1.1.20 and watch the latest hit over 50. I understand and support the idea this should be done correctly against an official GH OAuth app but breaking the GHE.com users in doing so has meant stalling recommending it internally. As a GHE enterprise customer would a ticket in to GH help, happy to apply any pressure to move this forward if it can help. For what it is worth I have raised a ticket for our GHE instance quoting MS's own blog post supporting OpenCode, and not mentioning any limitation to just GH.com. I'll share any response.
Author
Owner

@rekram1-node commented on GitHub (Feb 12, 2026):

Hey so just an update we submitted the github app for approval. WE had to remove the original ids and whatnot that used to work at the request of the copilot team.

Instead we are cooperating w/ their team to get things setup properly.

This path is ideal since it will serve our community best to be partners w/ them.

@rekram1-node commented on GitHub (Feb 12, 2026): Hey so just an update we submitted the github app for approval. WE had to remove the original ids and whatnot that used to work at the request of the copilot team. Instead we are cooperating w/ their team to get things setup properly. This path is ideal since it will serve our community best to be partners w/ them.
Author
Owner

@dotned commented on GitHub (Feb 13, 2026):

Hey so just an update we submitted the github app for approval. WE had to remove the original ids and whatnot that used to work at the request of the copilot team.

Instead we are cooperating w/ their team to get things setup properly.

This path is ideal since it will serve our community best to be partners w/ them.

100% onboard with the move, and don't think anyone disagrees, just some frustration with the breaking change and GH themselves, not the first time features have taken longer than you would expect to trickle down. Going to be great once it's in place.

@dotned commented on GitHub (Feb 13, 2026): > Hey so just an update we submitted the github app for approval. WE had to remove the original ids and whatnot that used to work at the request of the copilot team. > > Instead we are cooperating w/ their team to get things setup properly. > > This path is ideal since it will serve our community best to be partners w/ them. 100% onboard with the move, and don't think anyone disagrees, just some frustration with the breaking change and GH themselves, not the first time features have taken longer than you would expect to trickle down. Going to be great once it's in place.
Author
Owner

@vmagalhaes commented on GitHub (Feb 13, 2026):

@jtyr patching the binary directly works perfectly, as the replacement Client ID has the exact same length.

MacOS (Homebrew): Requires re-signing the binary to avoid zsh: killed.

Locate the actual binary inside the Cellar

OPENCODE_BINARY=$(find /opt/homebrew -path "/opencode-darwin-/bin/opencode" -type f 2>/dev/null | head -n 1)

Patch the ID

perl -pi -e 's/Ov23li8tweQw6odWQebz/Ov23ctDVkRmgkPke0Mmm/g' "$OPENCODE_BINARY"

Re-sign the binary (Crucial on macOS!)

sudo codesign --force --deep --sign - "$OPENCODE_BINARY"
Linux (Homebrew / Linuxbrew): Same process, but no code signing required.

Locate the binary (Standard Linuxbrew path)

OPENCODE_BINARY=$(find /home/linuxbrew/.linuxbrew -path "/opencode-linux-/bin/opencode" -type f 2>/dev/null | head -n 1)

Patch the ID

perl -pi -e 's/Ov23li8tweQw6odWQebz/Ov23ctDVkRmgkPke0Mmm/g' "$OPENCODE_BINARY"

For those that installed via npm in mac:

NPM_ROOT=$(npm root -g)

OPENCODE_BINARY=$(find "$NPM_ROOT/opencode-ai" \
  -path "*/opencode-darwin-*/bin/opencode" \
  -type f 2>/dev/null | head -n 1)

perl -pi -e 's/Ov23li8tweQw6odWQebz/Ov23ctDVkRmgkPke0Mmm/g' "$OPENCODE_BINARY"

sudo codesign --force --deep --sign - "$OPENCODE_BINARY"
@vmagalhaes commented on GitHub (Feb 13, 2026): > [@jtyr](https://github.com/jtyr) patching the binary directly works perfectly, as the replacement Client ID has the exact same length. > > **MacOS (Homebrew):** Requires re-signing the binary to avoid `zsh: killed`. > > # Locate the actual binary inside the Cellar > OPENCODE_BINARY=$(find /opt/homebrew -path "*/opencode-darwin-*/bin/opencode" -type f 2>/dev/null | head -n 1) > > # Patch the ID > perl -pi -e 's/Ov23li8tweQw6odWQebz/Ov23ctDVkRmgkPke0Mmm/g' "$OPENCODE_BINARY" > > # Re-sign the binary (Crucial on macOS!) > sudo codesign --force --deep --sign - "$OPENCODE_BINARY" > **Linux (Homebrew / Linuxbrew):** Same process, but no code signing required. > > # Locate the binary (Standard Linuxbrew path) > OPENCODE_BINARY=$(find /home/linuxbrew/.linuxbrew -path "*/opencode-linux-*/bin/opencode" -type f 2>/dev/null | head -n 1) > > # Patch the ID > perl -pi -e 's/Ov23li8tweQw6odWQebz/Ov23ctDVkRmgkPke0Mmm/g' "$OPENCODE_BINARY" For those that installed via npm in mac: ``` NPM_ROOT=$(npm root -g) OPENCODE_BINARY=$(find "$NPM_ROOT/opencode-ai" \ -path "*/opencode-darwin-*/bin/opencode" \ -type f 2>/dev/null | head -n 1) perl -pi -e 's/Ov23li8tweQw6odWQebz/Ov23ctDVkRmgkPke0Mmm/g' "$OPENCODE_BINARY" sudo codesign --force --deep --sign - "$OPENCODE_BINARY" ```
Author
Owner

@rekram1-node commented on GitHub (Feb 13, 2026):

The app has been approved by github btw, so this should be unblocked on ur orgs side?

@rekram1-node commented on GitHub (Feb 13, 2026): The app has been approved by github btw, so this should be unblocked on ur orgs side?
Author
Owner

@jtyr commented on GitHub (Feb 16, 2026):

@rekram1-node still no luck here:

$ curl -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'User-Agent: opencode/1.1.48' -d '{"client_id": "Ov23li8tweQw6odWQebz", "scope": "read:user"}' https://<company>.ghe.com/login/device/code
{"error":"Not Found"}
@jtyr commented on GitHub (Feb 16, 2026): @rekram1-node still no luck here: ``` $ curl -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'User-Agent: opencode/1.1.48' -d '{"client_id": "Ov23li8tweQw6odWQebz", "scope": "read:user"}' https://<company>.ghe.com/login/device/code {"error":"Not Found"} ```
Author
Owner

@rekram1-node commented on GitHub (Feb 16, 2026):

Yeah still needs to be rolled out to certain regions, will update tmr, I don't have access to this so im a middleman

@rekram1-node commented on GitHub (Feb 16, 2026): Yeah still needs to be rolled out to certain regions, will update tmr, I don't have access to this so im a middleman
Author
Owner

@Raviguntakala commented on GitHub (Feb 16, 2026):

will update tmr, I don't have access to this so im a middleman

Getting “Failed to initiate device authorization” error

@Raviguntakala commented on GitHub (Feb 16, 2026): > will update tmr, I don't have access to this so im a middleman Getting “Failed to initiate device authorization” error
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2607