Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

fix(db): remove OAuth fallback overwrite when email is missing to natively support multiple accounts

diegosouzapw03965bf76860
diff --git a/src/lib/db/providers.ts b/src/lib/db/providers.ts
index c6472a6f4e..4cad15fffd 100644
--- a/src/lib/db/providers.ts
+++ b/src/lib/db/providers.ts
@@ -51,15 +51,6 @@ export async function createProviderConnection(data: any) {
"SELECT * FROM provider_connections WHERE provider = ? AND auth_type = 'oauth' AND email = ?"
)
.get(data.provider, data.email);
- } else if (data.authType === "oauth" && !data.email) {
- // Fallback for providers that don't return email (e.g. Codex, Qwen):
- // find the most recently updated connection for this provider to update instead of duplicating
- existing = db
- .prepare(
- `SELECT * FROM provider_connections WHERE provider = ? AND auth_type = 'oauth'
- ORDER BY updated_at DESC LIMIT 1`
- )
- .get(data.provider);
} else if (data.authType === "apikey" && data.name) {
existing = db
.prepare(
diff --git a/src/lib/oauth/providers/qwen.ts b/src/lib/oauth/providers/qwen.ts
index 0a31c09212..e942aa6faa 100644
--- a/src/lib/oauth/providers/qwen.ts
+++ b/src/lib/oauth/providers/qwen.ts
@@ -47,6 +47,7 @@ export const qwen = {
};
},
mapTokens: (tokens) => {
+ console.log("QWEN RAW TOKENS:", JSON.stringify(tokens, null, 2));
let email = null;
let displayName = null;
if (tokens.id_token) {