-
Notifications
You must be signed in to change notification settings - Fork 60
[DOCS]: What OAuth scope is required for gh copilot
?
#1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for creating our first issue, @gr2m! 🎉
Since you're overriding the GitHub Copilot in the CLI currently works with OAuth tokens, but we have plans to support PATs in the near term. For now, using a PAT will trigger this error message. Lastly, there is no new scope for OAuth tokens to work with GitHub Copilot or atleast with GitHub Copilot in the CLI. |
🫡
I think it's a classic personal access token
|
😬 so we might need to improve the messaging here because you need to authenticate via the OAuth app in the web browser, not using a PAT. 🤔 $ gh auth login
? What account do you want to log into? GitHub.com
? What is your preferred protocol for Git operations? HTTPS
? How would you like to authenticate GitHub CLI? Login with a web browser
! First copy your one-time code: X#X#-X#X#
Press Enter to open github.com in your browser... |
Getting this error when trying to use copilot cli in a codespace. The GITHUB_TOKEN is already set so I have to remove it to perform the login again and then it works.
|
Thank you for adding to this issue, @gabynevada! This is absolutely a limitation with the current way GitHub Codespaces provides an automatic token when a codespace is created. As mentioned in "Troubleshooting authentication to a repository", this token is not a standard personal access token (PAT) or a token from authenticating GitHub or OAuth app but a user-to-server token ( Internally, discussions on how to extend Copilot integration support to PATs has been under discussion. I will make sure to bring up this aspect of leveraging with Codespaces ❤ |
Is there any way currently to obtain a valid OAuth token without opening a web browser? In a headless environment this is quite cumbersome. |
Also interested.. |
Yes, kind of, using the device flow: I think it's off topic for this question though, best to ask in https://github.com/orgs/community/discussions/categories/api-and-webhooks, feel free to ping me in there |
Hello @andyfeller My specific question is not about the CLI but it seems very related to the topic and I'm hoping you can assist. You wrote:
QuestionDoes this mean that the copilot access does not go through any scope? Is there a way to get a custom oAuth app to be able to approve github copilot in the device flow?
|
@bd82 : No, not currently. 😞 I have hopes given work around improving rate limit handling with the GitHub Copilot platform that this might change in the future. For now, GitHub Copilot in the CLI is only accessible via the GitHub CLI OAuth app. |
Thanks for the information @andyfeller |
My team is currently using PATs for installing npm packages from GitHub packages. Having to clear out that token from my environment every time I want to use this plugin isn't practical. |
@diminutivesloop : Could you share more about how your team is using I know some GitHub APIs don't support GitHub or OAuth tokens, which might be why your team needs a PAT working with |
@andyfeller We're not using
|
Maybe I'm wrong, but I feel like this should be mentioned somewhere more central than in the nth reply in a 1-year old issue. It's quite an important thing to know before deciding to use CLI-Copilot, especially since the only solution seems to be "stop using Not trying to be a Negative Nancy, it's just weird that such a limiting factor isn't mentioned anywhere else in the repo that would be more visible. Besides the the main README, there's multiple spots in the GitHub Copilot in the CLI documentation where this could be mentioned. |
@jtabox : What would you recommend beyond the following in the quickstart doc section of the repo docs? Lines 16 to 19 in ce71f26
|
I can think of 3 possible places:
Note To use and install GitHub Copilot in the CLI, you must have an active GitHub Copilot subscription and have GitHub CLI installed.
At least those were the places I looked in when trying to figure out why I got the error message :D |
Thanks for taking the time to soundboard suggestions, @jtabox! 🙇 I think suggestions 1 + 3 make the most sense for GitHub Copilot in the CLI being a separate extension from the core GitHub CLI. I'm going to follow up internally to cue this up as it requires changes to GitHub Docs as well as this repository. 👍 |
Happy to contribute :)
|
Sadly, these are changes on internal repos, but I appreciate your support 🙇 |
Yepp, I was a bit unclear in my reply I think. With "contribution" I meant my previous comment itself, with the suggestions. So "Happy to contribute" meant "Happy to have helped", not "I can open a PR with my suggestions if you'd like." 😄 But anyway, won't spam this thread any further 😄 For now I've switched to OAuth for |
@jtabox : Just to be clear, are you saying
I think you're saying the latter as below demonstrates that $ GITHUB_TOKEN=$(gh auth token --hostname github.com) gh copilot explain 'echo "hello world"'
Welcome to GitHub Copilot in the CLI!
version 1.0.5 (2024-09-12)
I'm powered by AI, so surprises and mistakes are possible. Make sure to verify any generated code or suggestions, and share feedback so that we can learn and improve. For more information, see https://gh.io/gh-copilot-transparency
Explanation:
• echo is used to print text to the terminal.
• "hello world" is the text that will be printed.
``` |
I'm not sure I understood your question correctly, so my reply might be completely irrelevant, in which case I apologize 😅 My When I first installed
But then when I tried to run Copilot I'd get an error.
I ran the suggested There wasn't any information anywhere that as long as I have a PAT as the If I understood correctly, what you're suggesting is the first alternative? I.e. to swap to OAuth and then change |
Thanks for clarifying, @jtabox! 👍 For clarity, I'm definitely not suggesting that people managing OAuth tokens in the environment variables; simply that it isn't a problem with environment variables as a mechanism but the nature of the token. Good news: with the repository readme updated and GitHub Docs change being processed, I feel this issue can long be closed. |
@andyfeller - I'm unclear on the solution. I too need the So, I did the following: unset GITHUB_TOKEN
gh auth login --web -h github.com
gh auth status ✘ 2
github.com
✓ Logged in to github.com account rosskevin (keyring)
- Active account: true
- Git operations protocol: https
- Token: gho_************************************
- Token scopes: 'gist', 'read:org', 'repo', 'workflow' but when opening a new terminal, back to the same error:
So I need to |
Maybe this needs to be new issue, but |
Yes, a separate issue for that would be ideal. That said, please trust when I say it's a topic I've been raising internally since initial extension development. There are some broader Copilot ecosystem architecture discussions involved. |
I've been trying to figure out how to use GH CLI and Copilot extension with PAT. Eventually I stumbled up this issue and the #98 which seems to be «a separate issue for that would be ideal». |
@yermulnik : created #116 to follow up on this 👍 |
@andyfeller Appreciate it 👍🏻 |
What I did to solve my problema was:
Now I can use the cli and keep my GITHUB_TOKEN for use in other scenarios. |
This solution with GH_TOKEN must be something new, because it hasn't been mentioned previously. And it's indeed a great solution, thanks for the tip. Used it just now in my Windows machine and it worked fine, so now there's no need to unset |
Describe the need
I use a local GITHUB_TOKEN environment variable instead of
gh
's own credential. What OAuth scope is necessary? Ideally I'd add that information to both the README and the error messageVersion
I installed the extension just now
Relevant terminal output
The text was updated successfully, but these errors were encountered: