[FEATURE]: Support Github Copilot Token flow #8590

Open
opened 2026-02-16 18:10:20 -05:00 by yindo · 4 comments
Owner

Originally created by @krishna1s on GitHub (Feb 5, 2026).

Originally assigned to: @thdxr on GitHub.

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Github Copilot CLI now have a way to to use PAT token flow for authentication using copilot api, is it possible now to use that flow instead of device code login flow. So that we can use opencode seemlessly, if anyone has tried out to make opencode work with github token directly instead of doing in device login manually

Originally created by @krishna1s on GitHub (Feb 5, 2026). Originally assigned to: @thdxr on GitHub. ### Feature hasn't been suggested before. - [ ] I have verified this feature I'm about to request hasn't been suggested before. ### Describe the enhancement you want to request Github Copilot CLI now have a way to to use PAT token flow for authentication using copilot api, is it possible now to use that flow instead of device code login flow. So that we can use opencode seemlessly, if anyone has tried out to make opencode work with github token directly instead of doing in device login manually
yindo added the discussion label 2026-02-16 18:10:20 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 5, 2026):

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

  • #5665: Support multiple authentication flows for enterprise SSO compatibility - discusses implementing PAT flow, OAuth code flow, and other auth methods beyond device code
  • #7299: Github Copilot interactive login - user requesting interactive login flow rather than API key entry

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

@github-actions[bot] commented on GitHub (Feb 5, 2026): This issue might be a duplicate of existing issues. Please check: - #5665: Support multiple authentication flows for enterprise SSO compatibility - discusses implementing PAT flow, OAuth code flow, and other auth methods beyond device code - #7299: Github Copilot interactive login - user requesting interactive login flow rather than API key entry Feel free to ignore if none of these address your specific case.
Author
Owner

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

@thdxr If you are open for this I can explore how this could be achieved and create a PR.

@repolevedavaj commented on GitHub (Feb 11, 2026): @thdxr If you are open for this I can explore how this could be achieved and create a PR.
Author
Owner

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

I spend a bit time on this and it seems that the PAT flow for Github Copilot is completely undocumented. When I try to just plain pass a PAT, I get "bad request: Personal Access Tokens are not supported for this endpoint"

Update: It only works if calling with Copilot-Integration-Id = copilot-developer-cli header. Probably we would need to reach out to GitHub to see if they could add OpenCode as offical integration, because its quite a hack to use their existing CLI ID.

@repolevedavaj commented on GitHub (Feb 16, 2026): I spend a bit time on this and it seems that the PAT flow for Github Copilot is completely undocumented. When I try to just plain pass a PAT, I get "bad request: Personal Access Tokens are not supported for this endpoint" Update: It only works if calling with `Copilot-Integration-Id = copilot-developer-cli` header. Probably we would need to reach out to GitHub to see if they could add OpenCode as offical integration, because its quite a hack to use their existing CLI ID.
Author
Owner

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

Update 2: I finally got it to work in OpenCode by directly writing the PAT into the auth.json as refresh and access token with no expiration + adding X-Workspace-Id as extra header in the opencode.json.

This is a really hacky solution, so if you are willing to add support for this officially @thdxr, you would probably need first to check with the guys at GitHub for an official integration ID - or ask them to allow PAT without this header.

@repolevedavaj commented on GitHub (Feb 16, 2026): Update 2: I finally got it to work in OpenCode by directly writing the PAT into the `auth.json` as refresh and access token with no expiration + adding `X-Workspace-Id` as extra header in the `opencode.json`. This is a really hacky solution, so if you are willing to add support for this officially @thdxr, you would probably need first to check with the guys at GitHub for an official integration ID - or ask them to allow PAT without this header.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8590