Skip to content

[FEATURE]: Support Github Copilot Token flow #12258

Closed as not planned
Closed as not planned

Description

@krishna1s

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

Activity

  1. added
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on Feb 5, 2026
  2. github-actions commented on Feb 5, 2026

    @github-actions
    Contributor

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

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

  3. repolevedavaj commented on Feb 11, 2026

    @repolevedavaj

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

  4. repolevedavaj commented on Feb 16, 2026

    @repolevedavaj

    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.

  5. repolevedavaj commented on Feb 16, 2026

    @repolevedavaj

    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 Copilot-Integration-Id = copilot-developer-cli 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.

  6. repolevedavaj commented on Feb 19, 2026

    @repolevedavaj

    I finally wrote them through our GitHub enterprise support channel and they will now check this.

  7. jamessimas commented on Mar 12, 2026

    @jamessimas

    @repolevedavaj

    Did you ever hear back?

    I'm looking to setup auth for OpenCode to GitHub Copilot using only an API token as well.

  8. repolevedavaj commented on Mar 12, 2026

    @repolevedavaj

    @jamessimas unfortunately, they confirmed that while Fine-Grained PATs are conditionally supported for official tools like the Copilot CLI, this authentication method is not currently supported for third-party tools like OpenCode. They also explicitly warned that spoofing the Copilot-Integration-Id header to get around this could result in accounts being flagged for abuse.

    They declined to provide a temporary exception and have instead logged this as formal product feedback for their leadership team to review. At this time, there is no timeline or guarantee on when or if this will be officially supported.

  9. repolevedavaj commented on Mar 12, 2026

    @repolevedavaj

    My personal takeaway is that restricting PAT authentication specifically is a strategic decision rather than just missing code. While they allow OpenCode for standard interactive use, locking down PATs ensures that automated, headless workflows remain strictly exclusive to GitHub's official tools.

  10. jamessimas commented on Mar 12, 2026

    @jamessimas

    @repolevedavaj

    I appreciate the fast reply! Thanks for the info.

  11. removed
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on May 3, 2026
  12. github-actions commented on Jul 3, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

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