Skip to content

Commit 6abb19f

Browse files
mrubensroomote[bot]brunobergher
authored andcommitted
Let people paste in the auth redirect url (RooCodeInc#7805)
Co-authored-by: roomote[bot] <219738659+roomote[bot]@users.noreply.github.com> Co-authored-by: Bruno Bergher <[email protected]>
1 parent b420d6b commit 6abb19f

39 files changed

+428
-39
lines changed

src/core/webview/webviewMessageHandler.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2305,6 +2305,48 @@ export const webviewMessageHandler = async (
23052305

23062306
break
23072307
}
2308+
case "rooCloudManualUrl": {
2309+
try {
2310+
if (!message.text) {
2311+
vscode.window.showErrorMessage(t("common:errors.manual_url_empty"))
2312+
break
2313+
}
2314+
2315+
// Parse the callback URL to extract parameters
2316+
const callbackUrl = message.text.trim()
2317+
const uri = vscode.Uri.parse(callbackUrl)
2318+
2319+
if (!uri.query) {
2320+
throw new Error(t("common:errors.manual_url_no_query"))
2321+
}
2322+
2323+
const query = new URLSearchParams(uri.query)
2324+
const code = query.get("code")
2325+
const state = query.get("state")
2326+
const organizationId = query.get("organizationId")
2327+
2328+
if (!code || !state) {
2329+
throw new Error(t("common:errors.manual_url_missing_params"))
2330+
}
2331+
2332+
// Reuse the existing authentication flow
2333+
await CloudService.instance.handleAuthCallback(
2334+
code,
2335+
state,
2336+
organizationId === "null" ? null : organizationId,
2337+
)
2338+
2339+
await provider.postStateToWebview()
2340+
} catch (error) {
2341+
provider.log(`ManualUrl#handleAuthCallback failed: ${error}`)
2342+
const errorMessage = error instanceof Error ? error.message : t("common:errors.manual_url_auth_failed")
2343+
2344+
// Show error message through VS Code UI
2345+
vscode.window.showErrorMessage(`${t("common:errors.manual_url_auth_error")}: ${errorMessage}`)
2346+
}
2347+
2348+
break
2349+
}
23082350

23092351
case "saveCodeIndexSettingsAtomic": {
23102352
if (!message.codeIndexSettings) {

src/i18n/locales/ca/common.json

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/de/common.json

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/en/common.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,12 @@
106106
},
107107
"api": {
108108
"invalidKeyInvalidChars": "API key contains invalid characters."
109-
}
109+
},
110+
"manual_url_empty": "Please enter a valid callback URL",
111+
"manual_url_no_query": "Invalid callback URL: missing query parameters",
112+
"manual_url_missing_params": "Invalid callback URL: missing required parameters (code and state)",
113+
"manual_url_auth_failed": "Manual URL authentication failed",
114+
"manual_url_auth_error": "Authentication failed"
110115
},
111116
"warnings": {
112117
"no_terminal_content": "No terminal content selected",

src/i18n/locales/es/common.json

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/fr/common.json

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/hi/common.json

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/id/common.json

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/it/common.json

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/i18n/locales/ja/common.json

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)