Can you have an anonymous user in FusionAuth?
-
I want users to be able to do things on my app (like add items to a cart) anonymously. Then, when they sign in or register, I want to transfer that cart over to their account.
Is that possible with FusionAuth?
-
Yes, you can do this.
There are a couple of different approaches, they both require a bit of glue code.
You could create a user in FusionAuth with a name like anon-<uuid>@example.com and a known random password. Then create a JWT for that account using the login API. Add info to that account, then if/when the user registers, transfer that account info to the new user. You could even update the email address of the anon-<uuid>@example.com account and reset their password. This would be accomplished via the user API.
An alternative approach is to use the Vend JWT API to create a JWT for your anonymous user. This can look like anything, it's entirely freeform. When the user registers, you can take the info referenced by that JWT and transfer it to the new user.
If these don't meet your needs, feel free to open a GitHub issue with a specific use case.
-