@fudrouter/fsrouter 0.6.88 → 0.6.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -98,14 +98,17 @@ export async function createProviderConnection(data) {
|
|
|
98
98
|
const all = db.all(`SELECT * FROM providerConnections WHERE provider = ?`, [data.provider]).map(rowToConn);
|
|
99
99
|
|
|
100
100
|
let existing = null;
|
|
101
|
-
if (data.authType === "oauth"
|
|
102
|
-
|
|
101
|
+
if (data.authType === "oauth" || data.authType === "access_token") {
|
|
102
|
+
// Dedupe only when the access token is identical — allows multiple
|
|
103
|
+
// accounts (different tokens, even same email) for device-code/OAuth
|
|
104
|
+
// providers like Nous, GitHub, etc.
|
|
105
|
+
const incomingToken = data.accessToken;
|
|
103
106
|
existing = all.find(c => {
|
|
104
|
-
if (c.authType !==
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (
|
|
108
|
-
return
|
|
107
|
+
if (c.authType !== data.authType) return false;
|
|
108
|
+
if (incomingToken && c.accessToken === incomingToken) return true;
|
|
109
|
+
// Fallback: email-only match only when no token is available yet
|
|
110
|
+
if (!incomingToken && data.email && c.email === data.email) return true;
|
|
111
|
+
return false;
|
|
109
112
|
});
|
|
110
113
|
} else if (data.authType === "apikey" && data.name) {
|
|
111
114
|
existing = all.find(c => c.authType === "apikey" && c.name === data.name);
|