Login is success but session was not created

Dear Friends,

I am not able to login due to the session problem in CakePHP 4.

the session is not created so how can fix it.

i have change already ,

‘Session’ => [

    'defaults' => 'database', //php and database


$this->Auth->setUser($user);// this is not working on production
return $this->redirect([‘action’ => ‘dataCollections’]);


In CakePHP 4, $this->Auth->setUser($user); looks to be deprecated. Looking at one of my CakePHP 4 projects, it looks like $this->Authentication->setIdentity($user); is the new version of that code.

Hope that helps!