• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What do the Response::deleteCookie() do?

#1
Hello,

I'm using JWT authentication with CI4, and I was making sing up function with the code below :

Code:
return $this->response
            ->deleteCookie('access_token')
            ->redirect('/');

But it doesn't work like what I expected, so I debugged on Reponse::deleteCookie() like :
Code:
public function deleteCookie(string $name = '', string $domain = '', string $path = '/', string $prefix = '')
    {
        if (empty($name))
        {
            return $this;
        }

        d($this->cookies);
        exit;
...

And I found that there is nothing in $this->cookies, so I'm very confusing.
The remarks of Response::deleteCookie() says, "Sets a cookie to be deleted when the response is sent."
But I think it doesn't work properly.

Am I doing something wrong?

P.S.
I'm setting cookies for jwt with the code below : 
Code:
$cookie = [
            'name'   => 'access_token',
            'value'  => $jwt,
            'expire' => '86500', // 1day
            'path'   => '/',
            'secure' => TRUE,
            'httponly' => FALSE
        ];

return $this->response
            ->setCookie($cookie)
            ->redirect('/');
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.