On my application, I give users the ability to browse as an anonymous user via createAnonymousSession
. I see that a new Anonymous user is created, with unique random UUID associated with it. However, when I let users register via the OAuth2 flow, they get succesfully registered as a user with a different user UUID. Based on the docs, I would not have expected this:"to allow the new user to convert an anonymous account to a normal account, you need to update its email and password or create an OAuth2 session." Is there a way to persist the uuid that's being assigned at the anonymous session to the registered user? What might I be doing wrong? CC @JurgenForster
I know it did mentioned this in the docs, But, from what I've seen in the code it looks like a new ID will always get generate https://github.com/appwrite/appwrite/blob/master/app/controllers/api/account.php#L514
You can also call the update email api
Thanks both! @Steven could you elaborate how this would work? In analogy to a shopping website, I'm currently letting anonymous users already browse my website, add items to a cart, etc. Then when I want them to submit their order, I ask them to signup. I want to enable this via OAuth. If the UUID of the user then changes, their data is not coupled to the UUID of the new user. Can I use the update email api in conjunction with OAuth for this?
Have you already tried creating an oauth2 session after already having an anonymous session? What uuid are you talking about?
hi @Steven , yes I have. As per the following:
- When user first browses to the site, an anonymous session is created. This session is also visible in the cloud interface, on the Auth tab. I write down the userid, let's refer to it as X.
- User can use the site, do some activities like adding some items to a shopping cart. This shopping cart information is send via an Appwrite function to a custom API that stores this data, with X as the primary key. (For reasons that go beyond the scope of this explanaition, I need to rely on this custom API for now)
- At a certain point, the user wants to signup, using the OAuth flow
- OAuth flow completes correctly, and new user is created. This user becomes visible in the Auth tab of the cloud interface as well. However, the userid for this new user is not the same as X, but is a newly generated userid Y.
- As a result, the shopping cart data is not linked anymore to the newly created user.
If the above is intended behavior, then I'll have to workaround this myself. However, from the docs I get the impression that anonymous users should get converted by the OAuth flow with user data being persisted within appwrite. If this is designed to be the case for everything except the userid, please let me know!
Thanks!!
What platform are you on?
@Steven WebSDK (vue)
Do you have any server side rendering?
Nope
but!
When testing out the flow as described above, somehow it now worked, and user_uuid of the Anonymouse WAS persisted after succesful authentication with OAuth. So the problem seems to have been solved. Was anything updated on the cloud Appwrite software side of things? I'm flabbergasted tbh
No updates
Recommended threads
- Upgrade Issue
Am having issue upgrading my appwrite account to pro as my card number is 19 and the required input is 16 digit
- createEmailPasswordSession Error using S...
Did someone succeed using SSR approach for login?
- [Solved] how to get user prefs from serv...
i want to get a specific users preferences from serverside maybe i missunderstood something