You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Support Github Copilot Token flow #12258
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
Reacted by repolevedavaj, JiamingJiao, Florian Kaiser, Sevenate and Clément XaT
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.
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.
@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.
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.
Activity
github-actions commentedon Feb 5, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
repolevedavaj commentedon Feb 11, 2026
@thdxr If you are open for this I can explore how this could be achieved and create a PR.
repolevedavaj commentedon 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-cliheader. 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 commentedon Feb 16, 2026
Update 2: I finally got it to work in OpenCode by directly writing the PAT into the
auth.jsonas refresh and access token with no expiration + addingCopilot-Integration-Id = copilot-developer-clias extra header in theopencode.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 commentedon Feb 19, 2026
I finally wrote them through our GitHub enterprise support channel and they will now check this.
jamessimas commentedon Mar 12, 2026
@repolevedavaj
Did you ever hear back?
I'm looking to setup auth for OpenCode to GitHub Copilot using only an API token as well.
repolevedavaj commentedon Mar 12, 2026
@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-Idheader 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.
repolevedavaj commentedon Mar 12, 2026
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.
jamessimas commentedon Mar 12, 2026
@repolevedavaj
I appreciate the fast reply! Thanks for the info.
github-actions commentedon Jul 3, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.