linkIdentityWithIdToken creates new user instead of linking anonymous account (Flutter)
Hi everyone, Iβm trying to upgrade an anonymous user to a permanent account using the new linkIdentityWithIdToken method in Flutter (supabase_flutter 2.10.1).
What I did 1. Signed in anonymously:
await supabase.auth.signInAnonymously();
await supabase.auth.signInAnonymously();
await client.auth.signInAnonymously();
await client.auth.signInAnonymously();
2. Confirmed supabase.auth.currentUser is anonymous 3. Signed in with Apple/Google SDK to get idToken (and accessToken for Google) 4. Called linkIdentityWithIdToken:
final response = await client.auth.linkIdentityWithIdToken( provider: OAuthProvider.apple, // or Google idToken: idToken, nonce: rawNonce, // for Apple accessToken: accessToken, // for Google);
final response = await client.auth.linkIdentityWithIdToken( provider: OAuthProvider.apple, // or Google idToken: idToken, nonce: rawNonce, // for Apple accessToken: accessToken, // for Google);
Expected: The anonymous user should be upgraded (same user.id). Actual: A new user is created, and the anonymous account is left orphaned.
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.