Closed musaev-haybulla closed 3 years ago
I am having a similar problem trying to remove a cookie
$response = FigResponseCookies::set($response, SetCookie::create('token') ->withValue($token) ->withDomain('') ->withPath('/') );
after using
$response = FigResponseCookies::expire($response, 'token');
I get an empty token as response with expiration in the past. But with the next GET
a request is send with the old token value.
I have the same problem. No one fix?
In case somebody wants to know how I solved this:
public function removeCookie($response = null, $name = '')
{
$out = Dflydev\FigCookies\FigResponseCookies::remove($response, $name);
return Dflydev\FigCookies\FigResponseCookies::set(
$response,
Dflydev\FigCookies\SetCookie::create($name)
->withPath('/')
->withExpires('Tue, 15-Jan-2013 21:47:38 GMT')
->withMaxAge(0)
);
}
I just set the expire date into the past by hand.
I went ahead with my proposal to deprecate the misleading facade methods in #45.
If i set withPath method, i cannot remove or modify cookie any way.
This code sets a cookie that I can delete:
$setCookie = SetCookie::create('auth')->withValue('1'); $response = FigResponseCookies::set($response, $setCookie);
but this code set cookie that i cannot remove (expire) and modify in Safari and Chrome (other browsers not verified)
$setCookie = SetCookie::create('auth')->withValue('1')->withPath('/'); $response = FigResponseCookies::set($response, $setCookie);
What could it be?.. And how can I fix it?..