You cannot do this with cookies only.
Cookies are stored for each browser (and sometimes for each mode or session) and, in any case, can be cleared by the user at his discretion.
Now evercookie is trying to get around this by storing data in different ways, in the hope that not all of them are cleared [at the same time]. These methods, used, however, are still generally limited to this browser / profile and depend on what additional mechanisms can be used. (EC can also be bypassed by simply disabling JavaScript, adjusting [cookie or in-flight] values ββusing the debugging tool or using a non-browser to initiate requests.)
Anyway, when using the EC approach (it may have limited success, depending on the demographics, but it is far from being βhackedβ), just set the [large] "random value" if the value is not set, and always send this value to server. (Actually, it makes no sense to require nonce from the user, since the server does not have the ability to verify that the original request was not a "duplicate", which is a kind of catch-22.)
Happy coding.
user166390
source share