Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

raultrysw's avatar

I dont cant to get the cookie

Hi, I am begining with laravel and I have choosen cookies to handle a login, and if a user is logged in, but I ended up making tests and in the /api/login route, I handle the data sended by the user by this way:

//code ommited
$response = response($token);
        $response->cookie(Cookie::make('logincookiename', 'value', 60));
        return $response;

At the end of the method I create, first a response object with the token, and I set next, the cookie logincookiename to 'value' but I am currently trying to retrieve that cookie in /articles (for testing) but I get nothing:

return response($request->cookie('logincookiename', 'aaa'));

How can I resolve this? :( Please help...

0 likes
0 replies

Please or to participate in this conversation.