Ajax Login - Cakephp 3

Good afternoon. I am having a big question I am using some parameters to enter with ajax, but when I send the ajax to this code it simply redirects without doing anything. I believe you have a better method but the documentation does not explain anything! If you can help me, thank you!

class ContaController extends AppController {
    public function initialize() {
        parent::initialize();
        $this->loadComponent('Flash');
        $this->loadComponent('Auth', [
            'authenticate' => [
                'Form' => [
                    'fields' => ['username' => 'email', 'password' => 'senha'],
                    'userModel' => 'Conta',
                ]
            ],
            'loginAction' => [
                'controller' => 'Conta',
                'action' => 'index'
            ],
            'loginRedirect' => [
                'controller' => 'Conta',
                'action' => 'minhaAgenda'
            ],
            'logoutRedirect' => [
                'controller' => '/'
            ],
            'storage' => 'Memory'
        ]);
        $this->Auth->allow(['index']);
    }

    public function index() {
        if ($this->request->is('ajax') || $this->request->is('post')) {
            $user = $this->Auth->identify();
            if ($user) {
                $this->Auth->setUser($user);
                echo 'success';
            } else {
                echo 'incorrect';
            }
        }
    }
    public function sair() {
        return $this->redirect($this->Auth->logout());
    }
}