Then when a user "signs up" you do the same thing. If they sent a token via cookie, you associate this token with their auth in your database. If they somehow didn't have a token yet they were probably blocking cookies, but you can just generate a new one at that point.
If a user logs in again later while they already had a token you can choose to migrate all data from that token to their login token, so no data that was created prior to login gets lost.
The point is that there's essentially no difference between regular profiles and shadow profiles. Both are just profiles. And a profile can be authenticated with using its token, or using an associated auth provider.
Plus, in Next, there was no way to associate a token to a social login during the new login in the backend. The only way is to do it via a separate request in the frontend and then relogin the user.
So... Kind of, yeah.
- https://supabase.com/blog/anonymous-sign-ins
- HN discussion: https://hw.leftium.com/#/item/40066560
Co-founder of SlashID here (one of the companies mentioned above). I think we have exactly what you are looking for:
https://www.slashid.dev/blog/anonymous-users/
https://developer.slashid.dev/docs/access/concepts/anonymous...
Hit me up if you want to chat more: [email protected]
I recently made a hacky solution for that using Next Auth (which is now called Authjs) because the requirements changed up on me and it's literally the ugliest and hackiest piece of code I've written in a long while.
I hate it and I doubt I'm going to ever recommend Authjs to anyone.
Any tips on what I should use instead?