If you're talking about IAnonymousIdFeature, then it is generated in AnonymousIdMiddleware, used in middleware pipeline with app.UseAnonymousId().
The ID is generated in the middleware with Guid.NewGuid() and stored in "EPiServer_Commerce_AnonymousId" cookie, and to my understanding it's not stored in database (with default implementation).
No, it is not stored separately in the database. And the middleware that generates the Anonymous ID has no event to hook into. The only where it is stored, is the shopping cart.
But I was thinking, if you don't want to pass the anonynous id cookie (many native apps prefer not to), and instead wants to include the anonymous id in the token, then you could look into generating your own as part of the token process.
Then you could add your own middleware to unwrap the token and get the anonymous id claim. As long as it adds an implementation of IAnonymousIdFeature before the built-in middleware, then the built-in will not run.
Hi,
OptiDict supports the anonymous flow. I'm creating a new anonymous token using the /token/anonymous endpoint using the anonymous ID that is generated by Optimziely. Now I would like to know if that generated anonymous ID that I'm using to generate a token is saved somewhere on the database. I was able to find the anonymous ID when creating a cart with that anonymous id. However, what I would like to know if it's saved somewhere on the database before creating a cart. Specfically when the anonymous ID is being generated.
Any help is appreciated.