Back

Bug on anonymous transfer to existing user

  • 0
  • Flutter
  • Accounts
Zuperman
17 Jan, 2024, 21:16

I think i found a bug on flutter sdk with account.createOAuth2Session(provider: provider);. It is always creating a new account instead of updating my existing anonymous user and linking it. Anyone has any experience?

TL;DR
Title: Bug on anonymous transfer to existing user - Flutter SDK Developers are discussing a bug in the Flutter SDK where the `account.createOAuth2Session` method creates a new account instead of updating and linking it to an existing anonymous user. The problem arises because the anonymous session is replaced by the OAuth session, and the anonymous session is not available in the webview used for OAuth. The current workaround is to delete the orphan anonymous user, but it is not an optimal solution. Solution: A potential solution suggested is to transfer the accounts that need to be linked and let the server API decide if they can be merged. Updating the
Drake
17 Jan, 2024, 21:22

There's sort of a limitation with flutter/mobile for this...The anonymous session only exists within the app, but when you're trying to create an oauth2 session, it's happening in (essentially) a webview that doesn't have the anonymous session. So, Appwrite doesn't know about the anonymous session in order to convert it

Zuperman
17 Jan, 2024, 21:35

you get the value back with the new id right? so you can link them both on a call

Zuperman
17 Jan, 2024, 21:36

at the moment what i did was delete the orphan anonymous user when it creates the new one, otherwise you get every single user duplicated in the db, but this is not optimal, it should merge the info automatically

Drake
17 Jan, 2024, 21:45

You can't just link with an id client side as that wouldn't be secure.

Also, the anonymous session is essentially replaced by the oauth one after the oauth flow because the cookie gets replaced.

Zuperman
17 Jan, 2024, 21:46

then you shoud change the documentation and tell the user that it doesn't link the accounts. The documentation clearly states that the anonymous user will be linked to the "provider" account

Zuperman
17 Jan, 2024, 21:47

that way we know in advance we are creating duplicated accounts and try to figure out a way ourselves

Zuperman
17 Jan, 2024, 21:48

also about this, it won't be secure on client side but it would on server side. I don't see an option to link accounts on server. I could transfer the accounts i want linked and let my own server api decide whether it is good to go

Drake
17 Jan, 2024, 21:49

Good idea. Would you please create a GitHub issue and include where you think would be a good place to add the note?

Zuperman
17 Jan, 2024, 21:49

ok

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more