Here’s a quick question about cookies and the Kirby Toolkit.
When I use the cookie::set
method, I get a cookie value that has its checksum prepended. This is fine, if I intend to use cookie::get
, which seems to be able to read and validate cookies created in this manner.
The trouble comes when I want to set a cookie with Javascript, and make it available to server-side logic. In my case, it’s dismissing a banner. Say I’m using a library to read and write cookies:
Cookie.set('banner_status', 'dismissed');
…and on the server…
cookie::get('banner_status'); # -> null
…presumably because it doesn’t pass the split-and-compare hash check within the cookie
class.
Any advice? Am I missing something really basic about cookie setting/getting? Do I have to resort to an AJAX call to set cookies only on the server?