我想销毁token,但这不起作用:
$ this -> Auth ->注销();
你能帮我吗?感谢所有
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());
}
Jwt未存储在服务器上。要注销,只需删除客户机上的令牌。如果您想在令牌失效之前使其失效,则必须手动向数据库插入令牌,并在每次请求时检查令牌是否失效