Aug 8, 2021
0
Level 1
Why is laravel cookie not being decrypted during axios requests?
When retrieving a cookie (Laravel 8), I get the actual string (decrypted) if I run the request from the browser but the encrypted version when I run an axios request.. why?
This is how I'm setting/getting the cookie:
public static function getCartId(): string
{
if (!$cookie = Cookie::get(self::COOKIE_NAME)) {
$cookie = (string) Str::uuid();
Cookie::queue(Cookie::forever(self::COOKIE_NAME, $cookie));
}
return $cookie;
}
I understand cookies ar encrypted/decrypted in EncryptCookies middleware which I made sure is running during both requests.
Please or to participate in this conversation.