fix: GitHub Copilot auth fails to open browser in Desktop app (#6957) (#8019)

Signed-off-by: Douwe Osinga <douwe@squareup.com>
Co-authored-by: Douwe Osinga <douwe@squareup.com>
This commit is contained in:
jh-block
2026-03-26 19:03:44 +01:00
committed by GitHub
parent 2977512bb5
commit 11f46dc0e0
9 changed files with 147 additions and 7 deletions
+6 -1
View File
@@ -90,12 +90,17 @@ export type ConfigKey = {
* Optional default value for the key
*/
default?: string | null;
/**
* Whether this OAuth flow uses the device code grant (RFC 8628)
* When true, the user must enter a verification code in the browser
*/
device_code_flow?: boolean;
/**
* The name of the configuration key (e.g., "API_KEY")
*/
name: string;
/**
* Whether this key should be configured using OAuth device code flow
* Whether this key should be configured using an OAuth flow
* When true, the provider's configure_oauth() method will be called instead of prompting for manual input
*/
oauth_flow: boolean;
@@ -56,6 +56,8 @@ function OAuthForm({
}
};
const isDeviceCodeFlow = provider.metadata.config_keys.some((key) => key.device_code_flow);
return (
<div className="flex flex-col items-center gap-3 py-4">
<Button
@@ -68,7 +70,9 @@ function OAuthForm({
{isLoading ? 'Signing in...' : `Sign in with ${provider.metadata.display_name}`}
</Button>
<p className="text-xs text-text-muted text-center">
A browser window will open for you to complete the login.
{isDeviceCodeFlow
? 'A browser window will open and the verification code will be copied to your clipboard. Paste it in the browser to complete sign-in.'
: 'A browser window will open for you to complete the login.'}
</p>
</div>
);
@@ -281,7 +281,9 @@ export default function ProviderConfigurationModal({
: `Sign in with ${provider.metadata.display_name}`}
</Button>
<p className="text-sm text-text-secondary text-center">
A browser window will open for you to complete the login.
{provider.metadata.config_keys.some((key) => key.device_code_flow)
? 'A browser window will open and the verification code will be copied to your clipboard. Paste it in the browser to complete sign-in.'
: 'A browser window will open for you to complete the login.'}
</p>
</div>
) : provider.metadata.config_keys.length === 0 &&