protected function _setJwt($userId)
    {
        $cookie = !empty($this->_controller()->Cookie->read('CookieAuth'));
        $expiration = $this->_controller()->Cookie->configKey('CookieAuth')['expires'];

        $this->_controller()->Cookie->configKey('Jwt', [
            'encryption' => false,
            'expires' => $cookie ? $expiration : 0,
        ]);
        $token = ['id' => $userId, 'exp' => time() + strtotime($expiration)];
        $jwt = JWT::encode($token, Security::salt());
        $this->_controller()->Cookie->write('Jwt', $jwt);
    }