I want to my customers are can be login through CustomerControlller. but when i implemented Auth component it gives me **false**

I want to my customers are can be login through CustomerControlller.
but when i implemented Auth component it gives me **false**

===========  **CustomersController** ================
<?php
namespace App\Controller;

use App\Controller\AppController;
use Cake\Auth\DefaultPasswordHasher;
use Cake\Mailer\MailerAwareTrait;
use Cake\ORM\TableRegistry;
use Hashids\Hashids;
use Cake\Event\Event;
use Cake\I18n\Time;
use Cake\Utility\Security;
use Cake\Core\Configure;

/**
 * Customers Controller
 *
 *
 * @method \App\Model\Entity\Customer[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
 */
class CustomersController extends AppController
{

    public function initialize()
    {
        parent::initialize();
        $this->loadModel('Users');
        $this->loadModel('ProfileSettings');
        

        $hasher = new DefaultPasswordHasher();
        // $myPass = $hasher->hash($this->request->getData('password'));

        try {
            $this->loadComponent('RequestHandler', [
                'enableBeforeRedirect' => false,
            ]);
        } catch (\Exception $e) {
        }
        try {
            $this->loadComponent('Flash');
        } catch (\Exception $e) {
        }
        try {
            $this->loadComponent('String');
        } catch (\Exception $e) {
        }

        $this->loadComponent('Auth', [
            'userModel' => 'Users',
            'authenticate' => [
                'Form' => [
                    'fields' => [
                        'username' => 'username',
                        'password' => 'password'
                    ],

                    //'scope' => ['status' => 1,'role'=>'Admin']
                    //'scope' => ['status' => 1]
                ]
            ],
            'loginAction' => [
                'controller' => 'Customers',
                'action' => 'login',
            ],
            //'loginRedirect' => '/Users/Add',
            'logoutRedirect' => $this->referer(),
            'authError' => 'Did you really think you are allowed to see that?',
            // If unauthorized, return them to page they were just on
            'unauthorizedRedirect' => $this->referer()
        ]);

        $this->Auth->allow(['forgetPassword','resetPassword','login']);
        /*SET LAYOUT*/
        $this->viewBuilder()->setLayout('Customer');
        $socialLinks  = $this->ProfileSettings->get(1);
        $this->set('ContactUs',$this->ContactUs->get(1));
        $this->set('socialLinks',$socialLinks);
        $this->set('title','Welcome Customer');
    }

    /**
     * Login method
     *
     * @param string|null $id User id.
     * @return \Cake\Http\Response|null
     * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
     */
    public function login()
    {
        $this->viewBuilder()->setLayout('loginlayout');
        if ($this->request->is('post')) {
            debug($this->request->getData()); // Return email & with unhashed password
            $user = $this->Auth->identify();
            debug(  $this->Auth->identify()  ); die;
            if ( $user ) {
                $this->Auth->setUser($user);
                //pr($user); die;
                return $this->redirect($this->Auth->redirectUrl());
            }
            $this->Flash->error('Your username or password is incorrect.');
        }
        $this->set('userdetails',$this->Auth->user());
        $this->set('title','Login - Customer');
    }

    /**
     * Logout method
     *
     * @param string|null $id User id.
     * @return \Cake\Http\Response|null
     * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
     */

    public function logout()
    {
        $this->Flash->success('You are now logged out.');
        return $this->redirect($this->Auth->logout());
    }
    /**
     * Index method
     *
     * @return \Cake\Http\Response|void
     */



===========  **AppController ** ================

<?php

namespace App\Controller;

use Cake\Controller\Controller;
use Cake\Event\Event;

/**
 * Application Controller
 *
 * Add your application-wide methods in the class below, your controllers
 * will inherit them.
 *
 * @link https://book.cakephp.org/3.0/en/controllers.html#the-app-controller
 */
class AppController extends Controller
{

    /**
     * Initialization hook method.
     *
     * Use this method to add common initialization code like loading components.
     *
     * e.g. `$this->loadComponent('Security');`
     *
     * @return void
     * @throws \Exception
     */
    public function initialize()
    {
        parent::initialize();

        /*
         * PRE DEFINE PROJECT OBJECT */
        $this->set('projectTitle',"Car");
        $this->set('ProjectObjectGlobel',"Car");
        $this->loadComponent('RequestHandler', [
            'enableBeforeRedirect' => false,
        ]);
        $this->loadComponent('Flash');
        $this->loadComponent('Qimage');
        $this->loadComponent('String');
        date_default_timezone_set('Asia/Kolkata');
        /*
         * Enable the following component for recommended CakePHP security settings.
         * see https://book.cakephp.org/3.0/en/controllers/components/security.html
         */
        //$this->loadComponent('Security');
    }


===========  **User Entity** ================
<?php
namespace App\Model\Entity;

use Cake\Auth\DefaultPasswordHasher;
use Cake\ORM\Entity;

/**
 * User Entity
 *
 * @property int $id
 * @property string $first_name
 * @property string|null $last_name
 * @property string $pic
 * @property string $email
 * @property string|null $phonecode
 * @property int $phone
 * @property string|null $social
 * @property string|null $social_number
 * @property string|null $company
 * @property string|null $tax
 * @property string $address1
 * @property string|null $address2
 * @property string $username
 * @property int $country_id
 * @property string $state
 * @property string $city
 * @property int|null $fax
 * @property string $password
 * @property string|null $role
 * @property string $newsletter
 * @property string $is_policy_agree
 * @property string $payment_method
 * @property string|null $registred_ipv4
 * @property string|null $last_login_ipv4
 * @property string|null $token
 * @property int|null $reset_password_attempt
 * @property int $status
 * @property \Cake\I18n\FrozenTime|null $created
 * @property \Cake\I18n\FrozenTime|null $modified
 *
 * @property \App\Model\Entity\Country $country
 * @property \App\Model\Entity\Booking[] $bookings
 * @property \App\Model\Entity\CancelledBooking[] $cancelled_bookings
 * @property \App\Model\Entity\Review[] $reviews
 */
class User extends Entity
{
    /**
     * Fields that can be mass assigned using newEntity() or patchEntity().
     *
     * Note that when '*' is set to true, this allows all unspecified fields to
     * be mass assigned. For security purposes, it is advised to set '*' to false
     * (or remove it), and explicitly make individual fields accessible as needed.
     *
     * @var array
     */
    protected $_accessible = [
        'first_name' => true,
        'last_name' => true,
        'pic' => true,
        'email' => true,
        'phonecode' => true,
        'phone' => true,
        'social' => true,
        'social_number' => true,
        'company' => true,
        'tax' => true,
        'address1' => true,
        'address2' => true,
        'username' => true,
        'country_id' => true,
        'state' => true,
        'city' => true,
        'fax' => true,
        'password' => true,
        'role' => true,
        'newsletter' => true,
        'is_policy_agree' => true,
        'payment_method' => true,
        'registred_ipv4' => true,
        'last_login_ipv4' => true,
        'token' => true,
        'reset_password_attempt' => true,
        'status' => true,
        'created' => true,
        'modified' => true,
        'country' => true,
        'bookings' => true,
        'cancelled_bookings' => true,
        'reviews' => true
    ];

    /**
     * Fields that are excluded from JSON versions of the entity.
     *
     * @var array
     */
    protected $_hidden = [
        'password',
        'token'
    ];
    /**
     * Hash the password before to save.
     *
     * @param string $password Password to be hashed.
     *
     * @return string
     */
    protected function _setPassword($password)
    {
        return (new DefaultPasswordHasher)->hash($password);
    }

    /*protected function _getPassword($value)
    {
        $hasher = new DefaultPasswordHasher();
        return $hasher->hash($value);
    }*/
}


===========  **User Table** ================

<?php
namespace App\Model\Table;

use Cake\ORM\Query;
use Cake\ORM\RulesChecker;
use Cake\ORM\Table;
use Cake\Validation\Validator;

/**
 * Users Model
 *
 * @property \App\Model\Table\CountriesTable|\Cake\ORM\Association\BelongsTo $Countries
 * @property \App\Model\Table\BookingsTable|\Cake\ORM\Association\HasMany $Bookings
 * @property \App\Model\Table\CancelledBookingsTable|\Cake\ORM\Association\HasMany $CancelledBookings
 * @property \App\Model\Table\ReviewsTable|\Cake\ORM\Association\HasMany $Reviews
 * @property |\Cake\ORM\Association\HasMany $ViewFullBookings
 * @property |\Cake\ORM\Association\HasMany $ViewFullBookingsFinal
 *
 * @method \App\Model\Entity\User get($primaryKey, $options = [])
 * @method \App\Model\Entity\User newEntity($data = null, array $options = [])
 * @method \App\Model\Entity\User[] newEntities(array $data, array $options = [])
 * @method \App\Model\Entity\User|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
 * @method \App\Model\Entity\User saveOrFail(\Cake\Datasource\EntityInterface $entity, $options = [])
 * @method \App\Model\Entity\User patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
 * @method \App\Model\Entity\User[] patchEntities($entities, array $data, array $options = [])
 * @method \App\Model\Entity\User findOrCreate($search, callable $callback = null, $options = [])
 *
 * @mixin \Cake\ORM\Behavior\TimestampBehavior
 */
class UsersTable extends Table
{
    /**
     * Initialize method
     *
     * @param array $config The configuration for the Table.
     * @return void
     */
    public function initialize(array $config)
    {
        parent::initialize($config);

        $this->setTable('users');
        $this->setDisplayField('name');
        $this->setPrimaryKey('id');

        $this->addBehavior('Timestamp');

        $this->belongsTo('Countries', [
            'foreignKey' => 'country_id',
            'joinType' => 'INNER'
        ]);
        $this->hasMany('Bookings', [
            'foreignKey' => 'user_id'
        ]);
        $this->hasMany('CancelledBookings', [
            'foreignKey' => 'user_id'
        ]);
        $this->hasMany('Reviews', [
            'foreignKey' => 'user_id'
        ]);
        $this->hasMany('ViewFullBookings', [
            'foreignKey' => 'user_id'
        ]);
       /* $this->hasMany('ViewFullBookingsFinal', [
            'foreignKey' => 'user_id'
        ]);*/
    }

    /**
     * Default validation rules.
     *
     * @param \Cake\Validation\Validator $validator Validator instance.
     * @return \Cake\Validation\Validator
     */
    public function validationDefault(Validator $validator){
        $validator
            ->integer('id')
            ->allowEmptyString('id', 'create');

        $validator
            ->scalar('first_name')
            ->maxLength('first_name', 100,'Only 100 characters are allowed')
            ->requirePresence('first_name', 'create')
            ->allowEmptyString('first_name', false);

        $validator
            ->scalar('last_name')
            ->maxLength('last_name', 100,'Only 100 characters are allowed')
            ->allowEmptyString('last_name');

        /*$validator
            ->scalar('pic')
            ->maxLength('pic', 255)
            ->allowEmptyString('pic', false);*/

        $validator
            ->email('email')
            ->maxLength('email', 50,'Only 50 characters are allowed')
            ->requirePresence('email', 'create')
            ->allowEmptyString('email', false)
            ->add('email', 'unique', ['rule' => 'validateUnique', 'provider' => 'table','message'=>'This email already exists']);

        $validator
            // ->integer('phone')
            ->minLength('phone', 10, 'Minimum 10 character is required')
            ->maxLength('phone', 15, 'Max 15 character is required')
            ->requirePresence('phone', 'create')
            ->allowEmptyString('phone', false);

        $validator
            ->scalar('social')
            ->maxLength('social', 50)
            ->allowEmptyString('social',true);

        $validator
            ->scalar('social_number')
            ->maxLength('social_number', 20,'Only 20 characters are allowed')
            ->allowEmptyString('social_number',true);

        $validator
            ->scalar('company')
            ->maxLength('company', 255,'Only 255 characters are allowed')
            ->allowEmptyString('company');

        $validator
            ->scalar('tax')
            ->maxLength('tax', 50,'Only 50 characters are allowed')
            ->allowEmptyString('tax',true);

        $validator
            ->scalar('address1')
            ->maxLength('address1', 4294967295)
            ->requirePresence('address1', 'create')
            ->allowEmptyString('address1', false);

        $validator
            ->scalar('address2')
            ->maxLength('address2', 4294967295)
            ->allowEmptyString('address2');

        $validator
            ->scalar('username')
            ->maxLength('username', 20,'Only 20 characters are allowed')
            ->requirePresence('username', 'create')
            ->allowEmptyString('username', false)
            ->add('username', 'unique', ['rule' => 'validateUnique', 'provider' => 'table','message'=>'This username already exists']);

        /*$validator
            ->scalar('state')
            ->maxLength('state', 50,'Only 50 characters are allowed')
            ->requirePresence('state', 'create')
            ->allowEmptyString('state', true);*/

        $validator
            ->scalar('city')
            ->maxLength('city', 200,'Only 200 characters are allowed')
            ->requirePresence('city', 'create')
            ->allowEmptyString('city', false);

        $validator
            ->integer('fax')
            ->maxLength('fax', 250,'Only 250 characters are allowed')
            ->allowEmptyString('fax',true);

        $validator
            ->scalar('password')
            ->maxLength('password', 255,'Only 255 characters are allowed')
            ->requirePresence('password', 'create')
            ->allowEmptyString('password', false);

        /*$validator
            ->scalar('role')
            ->maxLength('role', 10)
            ->allowEmptyString('role');

        $validator
            ->scalar('newsletter')
            ->requirePresence('newsletter', 'create')
            ->allowEmptyString('newsletter', false);

        $validator
            ->scalar('is_policy_agree')
            ->requirePresence('is_policy_agree', 'create')
            ->allowEmptyString('is_policy_agree', false);

        $validator
            ->scalar('payment_method')
            ->requirePresence('payment_method', 'create')
            ->allowEmptyString('payment_method', false);

			 $validator
            ->integer('phone')
            ->requirePresence('phone', 'create')
            ->allowEmptyString('phone', false);
			*/
        $validator
            ->scalar('registred_ipv4')
            ->maxLength('registred_ipv4', 100)
            ->allowEmptyString('registred_ipv4',true);

        $validator
            ->scalar('last_login_ipv4')
            ->maxLength('last_login_ipv4', 100)
            ->allowEmptyString('last_login_ipv4',true);

        $validator
            ->scalar('token')
            ->maxLength('token', 255)
            ->allowEmptyString('token',true);

        $validator
            ->integer('reset_password_attempt')
            ->allowEmptyString('reset_password_attempt',true);


        $validator
            ->allowEmptyString('status', false);

        return $validator;
    }


    /**
     * Returns a rules checker object that will be used for validating
     * application integrity.
     *
     * @param \Cake\ORM\RulesChecker $rules The rules object to be modified.
     * @return \Cake\ORM\RulesChecker
     */
    public function buildRules(RulesChecker $rules)
    {
        $rules->add($rules->isUnique(['email']));
        $rules->add($rules->isUnique(['username']));
        $rules->add($rules->existsIn(['country_id'], 'Countries'));

        return $rules;
    }
}


HELP

Look in your code:
$this->loadComponent(‘Auth’, [ ‘userModel’ => ‘Users’, ‘authenticate’ => [ ‘Form’ => [ ‘fields’ => [ ‘username’ => ‘username’, ‘password’ => ‘password’ ],

What, specifically, “gives you false”? There’s a lot of code here.

You are using the cake conventions. So, for minimize the chance for typeing something wrong, try to just call the auth component, without set the rules that are exactly the conventions it expect. Doing it, should be easier to track the error

Try adding the following function in CustomersController:

    public function isAuthorized($user)
    {
        return true;
    }

And check that the fields used in the Auth component and the login view match:

image

View example