You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Migrating from twitter (OAuth 1.0a) to x (OAuth 2.0) creates duplicate users when the X account email has changed #2892
When an app migrates from the legacy twitter provider (OAuth 1.0a) to the new x provider (OAuth 2.0), existing users are linked to their account only through automatic identity linking by email.
If a user's X account email has changed since they originally signed up, their first x sign-in creates a new user instead of linking to the existing one, even though both identities have the same provider_id (the X user ID).
We followed the migration recommended in the announcement blog and the X / Twitter docs, and hit this in production. Neither page mentions this risk.
To Reproduce
Sign up with signInWithOAuth({ provider: 'twitter' }).
Change the email address on the X account and verify it.
Switch the app to signInWithOAuth({ provider: 'x' }), sign out, and sign in with the same X account.
A new user is created.
auth.identities after step 3:
provider
user_id
email
provider_id
twitter
(existing user)
old email
same
x
(new user)
new email
same
auth.audit_log_entries shows user_signedup with {"provider":"x"} for the new user, while other legacy users whose email did not change get identity_linked as expected.
Expected behavior
The x identity is linked to the existing user, because auth.identities already has a twitter identity with the same provider_id.
Screenshots
N/A
System information
Hosted Supabase (supabase.com)
Additional context
Once a user has an x identity, later email changes are fine, because sign-in looks up (provider, provider_id). The problem is limited to the firstx sign-in of legacy twitter users whose X email no longer matches.
Users who stay signed in during the migration are affected later, when they sign out or switch devices.
It adds a "Migrate from Twitter (OAuth 1.0a)" section to the X / Twitter login guide that:
Explains that automatic linking matches by email only, so users whose X email changed can get a new user, or an x identity linked to a different existing user, on their first x sign-in
Recommends linking the x identity with linkIdentity() while users are still signed in with twitter, and checking that both identities have the same X user ID
Includes a query to find twitter and x identities that share a provider_id but belong to different users
This only documents the risk. Linking by provider_id across both providers would still need a change in supabase/auth. Happy to adjust the wording if the Auth team prefers a different migration path.
Thanks a lot for picking this up and opening supabase/supabase#52483 so quickly! The new section matches what we saw, and the query for finding affected users is really helpful.
Hi! I'd be interested in investigating the server-side fix for this issue.
I traced the current account-linking logic in internal/models/linking.go and noticed that the identity lookup is scoped to both provider and provider_id, while subsequent automatic linking relies on verified emails.
Since the documentation mitigation is already being addressed in supabase/supabase#52483, would the Auth team be open to a narrowly scoped identity-equivalence policy for the legacy twitter and newer x providers?
I'd like to clarify the expected handling of existing duplicate accounts, conflicting email ownership and configured linking domains before implementing the change and adding regression tests.
Activity
docs(auth): document duplicate users risk when migrating from twitter…
luchersou commentedon Oct 29, 2026
I opened a docs PR for the second suggestion: supabase/supabase#52483
It adds a "Migrate from Twitter (OAuth 1.0a)" section to the X / Twitter login guide that:
xidentity linked to a different existing user, on their firstxsign-inxidentity withlinkIdentity()while users are still signed in withtwitter, and checking that both identities have the same X user IDtwitterandxidentities that share aprovider_idbut belong to different usersThis only documents the risk. Linking by
provider_idacross both providers would still need a change insupabase/auth. Happy to adjust the wording if the Auth team prefers a different migration path.noname241198 commentedon Oct 29, 2026
Thanks a lot for picking this up and opening supabase/supabase#52483 so quickly! The new section matches what we saw, and the query for finding affected users is really helpful.
Hallidayo commentedon Oct 29, 2026
Moved across from the
supabase/supabaserepo as seems an auth issue.ShivamJuyal24 commentedon Nov 27, 2026
Hi! I'd be interested in investigating the server-side fix for this issue.
I traced the current account-linking logic in
internal/models/linking.goand noticed that the identity lookup is scoped to bothproviderandprovider_id, while subsequent automatic linking relies on verified emails.Since the documentation mitigation is already being addressed in supabase/supabase#52483, would the Auth team be open to a narrowly scoped identity-equivalence policy for the legacy
twitterand newerxproviders?I'd like to clarify the expected handling of existing duplicate accounts, conflicting email ownership and configured linking domains before implementing the change and adding regression tests.
Would this approach be acceptable?