-
Notifications
You must be signed in to change notification settings - Fork 3.1k
fix: GitHub Copilot auth fails to open browser in Desktop app (#6957) #8019
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -285,6 +285,16 @@ impl GithubCopilotProvider { | |
| async fn login(&self) -> Result<String> { | ||
| let device_code_info = self.get_device_code().await?; | ||
|
|
||
| if let Ok(mut clipboard) = arboard::Clipboard::new() { | ||
| if let Err(e) = clipboard.set_text(&device_code_info.user_code) { | ||
| tracing::warn!("Failed to copy verification code to clipboard: {}", e); | ||
| } | ||
| } | ||
|
|
||
| if let Err(e) = webbrowser::open(&device_code_info.verification_uri) { | ||
| tracing::warn!("Failed to open browser: {}", e); | ||
|
Comment on lines
+294
to
+295
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This opens the verification URL from inside Useful? React with 👍 / 👎. |
||
| } | ||
|
|
||
| println!( | ||
| "Please visit {} and enter code {}", | ||
| device_code_info.verification_uri, device_code_info.user_code | ||
|
|
@@ -402,7 +412,7 @@ impl ProviderDef for GithubCopilotProvider { | |
| GITHUB_COPILOT_DEFAULT_MODEL, | ||
| GITHUB_COPILOT_KNOWN_MODELS.to_vec(), | ||
| GITHUB_COPILOT_DOC_URL, | ||
| vec![ConfigKey::new_oauth( | ||
| vec![ConfigKey::new_oauth_device_code( | ||
| "GITHUB_COPILOT_TOKEN", | ||
| true, | ||
| true, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If clipboard access is unavailable here (common in WSL/headless Linux/some sandboxed desktop sessions), the only fallback is the later
println!, but the Electron wrapper stops forwardinggoosedstdout after startup (ui/desktop/src/goosed.ts:306-316) and the OAuth endpoint only returns after the whole flow completes (crates/goose-server/src/routes/config_management.rs:898-910). In those environments the user still sits on "Signing in..." with no verification code to enter manually.Useful? React with 👍 / 👎.