Laravel 5.4 - Cookie Queue

Viewed 17191

I'm using Laravel 5.4 and I wrote something like:

     Cookie::queue(
        'refresh_token',
        $data->refresh_token,
        864000, // 10 days
        null,
        null,
        false,
        true // HttpOnly
    );

    return response('hello world');

The returned response doesn't contain the refresh_token cookie while return response('hello world')->withCookie(...) does.

The Laravel 5.4 documentation doesn't anymore state queueing cookie as 5.0 doc does. Does it mean that the functionality has been removed in version 5.4 or did I make a mistake in my code?

For sake of completeness, I'm using Dingo API package and the response is crafted it.

Thank you for your help.

2 Answers

In case anyone fond their way here by Google, one way for cookie inclusion to silently fail is if you're explicitly defining your domain variable in its creation, and forgot to remove the "http://" from the beginning of it first. That's not the case with OP, but it was what brought me here. ;)

Related