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

This commit is contained in:
diegosouzapw
2026-02-21 13:04:06 -03:00
parent 6b34a39f6e
commit 03965bf768
2 changed files with 1 additions and 9 deletions

View File

@@ -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(

View File

@@ -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) {