fix(oauth): update Qwen OAuth URLs from chat.qwen.ai to qwen.ai (#4561)

Integrated into release/v3.8.34 (rebuilt onto tip)
This commit is contained in:
Diego Rodrigues de Sa e Souza
2026-06-22 17:07:46 -03:00
committed by GitHub
parent e6af1ed743
commit 2bdf37796e
2 changed files with 14 additions and 2 deletions

View File

@@ -99,8 +99,8 @@ export const GEMINI_CONFIG = {
// Qwen OAuth Configuration (Device Code Flow with PKCE)
export const QWEN_CONFIG = {
clientId: resolvePublicCred("qwen_id", "QWEN_OAUTH_CLIENT_ID"),
deviceCodeUrl: "https://chat.qwen.ai/api/v1/oauth2/device/code",
tokenUrl: "https://chat.qwen.ai/api/v1/oauth2/token",
deviceCodeUrl: "https://qwen.ai/api/v1/oauth2/device/code",
tokenUrl: "https://qwen.ai/api/v1/oauth2/token",
scope: "openid profile email model.completion",
codeChallengeMethod: "S256",
};

View File

@@ -293,6 +293,18 @@ test("all provider endpoint URLs use HTTPS when a URL is configured", () => {
}
});
test("Qwen OAuth uses qwen.ai (not chat.qwen.ai) for device/token URLs — upstream PR #683 / decolua issue #572", () => {
// The legacy host `chat.qwen.ai` started returning errors; the correct authoritative
// host for Qwen's device-code OAuth endpoints is `qwen.ai`. Regression guard for the
// port of decolua/9router#683 (closes decolua issue #572).
const deviceUrl = new URL(QWEN_CONFIG.deviceCodeUrl);
const tokenUrl = new URL(QWEN_CONFIG.tokenUrl);
assert.equal(deviceUrl.hostname, "qwen.ai", "deviceCodeUrl must use qwen.ai");
assert.equal(tokenUrl.hostname, "qwen.ai", "tokenUrl must use qwen.ai");
assert.equal(deviceUrl.pathname, "/api/v1/oauth2/device/code");
assert.equal(tokenUrl.pathname, "/api/v1/oauth2/token");
});
test("browser-based providers expose buildAuthUrl and return provider-specific auth URLs", () => {
const redirectUri = "http://localhost:43121/callback";
const state = "state-123";