'Auth logout in cakephp 3x with plugin ADmad/cakephp-jwt-auth

I want destroy token but that not working:

$this->Auth->logout();

Can you help me. Thank all



Solution 1:[1]

 public function login()
    {
        if ($this->request->is('post')) {
            $user = $this->Auth->identify();
            if ($user) {
                $this->Auth->setUser($user);
                return $this->redirect($this->Auth->redirectUrl());
            }
            $this->Flash->error(__('Invalid username or password, try again'));
        }
    }

    public function logout()
    {
        return $this->redirect($this->Auth->logout());
    }

Solution 2:[2]

Jwt is not stored on server. To logout you just delete the token on the client. If you want to invalidate before it exprire, you have to manually insert token to the database and on every request check if token is invalidated or not

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Aslan Mammadrzayev
Solution 2 Binh