From 1b4bcc2158a12f10a1006a8b236131ba31d874b0 Mon Sep 17 00:00:00 2001 From: Ehab Younes Date: Wed, 21 Jan 2026 15:16:58 +0300 Subject: [PATCH] Add OAuth 2.1 feature flag --- package.json | 8 ++++++++ src/promptUtils.ts | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/package.json b/package.json index 79445065..4ec31b27 100644 --- a/package.json +++ b/package.json @@ -122,6 +122,14 @@ "type": "boolean", "default": false }, + "coder.experimental.oauth": { + "markdownDescription": "Enable [OAuth 2.1](https://coder.com/docs/admin/integrations/oauth2-provider) authentication. When enabled, you'll be prompted to choose between OAuth and session token authentication during login. OAuth provides automatic token refresh, eliminating the need to manually re-authenticate when your session expires.", + "type": "boolean", + "default": false, + "tags": [ + "experimental" + ] + }, "coder.sshFlags": { "markdownDescription": "Additional flags to pass to the `coder ssh` command when establishing SSH connections. Enter each flag as a separate array item; values are passed verbatim and in order. See the [CLI ssh reference](https://coder.com/docs/reference/cli/ssh) for available flags.\n\nNote: `--network-info-dir` and `--ssh-host-prefix` are ignored (managed internally). Prefer `#coder.proxyLogDirectory#` over `--log-dir`/`-l` for full functionality.", "type": "array", diff --git a/src/promptUtils.ts b/src/promptUtils.ts index 9e3d8895..fd5beaf1 100644 --- a/src/promptUtils.ts +++ b/src/promptUtils.ts @@ -138,6 +138,14 @@ export async function maybeAskUrl( export async function maybeAskAuthMethod( client: CoderApi, ): Promise { + const experimentalOAuthEnabled = vscode.workspace + .getConfiguration("coder") + .get("experimental.oauth", false); + + if (!experimentalOAuthEnabled) { + return "legacy"; + } + // Check if server supports OAuth with progress indication const supportsOAuth = await vscode.window.withProgress( {