From 593e9f2f56455b06e3e46d330e1a5a07a912273c Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Tue, 30 Sep 2025 21:08:10 +0000 Subject: [PATCH] Prevent duplicate linking attempts cgen-fcba06e1c28348139bc678b7ac576922 --- client/contexts/AuthContext.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/client/contexts/AuthContext.tsx b/client/contexts/AuthContext.tsx index 03d4967e..9f83aea0 100644 --- a/client/contexts/AuthContext.tsx +++ b/client/contexts/AuthContext.tsx @@ -320,6 +320,17 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ }); return; } + + const alreadyLinked = user.identities?.some( + (identity: any) => identity.provider === provider, + ); + if (alreadyLinked) { + aethexToast.info({ + title: "Already linked", + description: `Your ${provider} account is already connected.`, + }); + return; + } try { const { data, error } = (await supabase.auth.linkIdentity({ provider,