I want to create a eCommerce app which has a cart that can store the items. But the problem is that I want to add items in cart without login and after login the items should be transferred to the user's cart from where he/she can proceed to buy Database I want to use is firebase

P.S. the user can enter the items in the cart without login but for buying he/she need to login

1 Answers

Frank van Puffelen On

It sounds like you want to have an account for the user, without requiring them to explicitly enter their credentials. For that, consider using Firebase anonymous authentication, which generates a unique user id (UID) for the user. You can use this UID so associate data with the specific user.

This UID will be maintained, even when they restart the app, until they explicitly sign out or uninstall the app. You can even allow the users to upgrade their account, by allowing them to sign in with an additional provider, and then linking that to their anonymous account.