Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/lib/oauth/constants/oauth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
};
Expand Down
12 changes: 12 additions & 0 deletions tests/unit/oauth-providers-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Loading