User table for login

Hi, I use cake php 4 and Authentication plugin and JWT. I changed the table from User to another one setting userModel property in resolver. The login is ok but when I try to get identity cake use table Users and so I receive 401 error. Anyone have suggestion? Donatella …

What does “try to get identity” mean in this context?

I followed the instructions found in this project GitHub - ishanvyas22/cakephp-jwt-authentication-demo: CakePHP JWT authentication demo using Authentication plugin
In Application I set the userModel
$service->loadIdentifier(‘Authentication.Password’, [
‘returnPayload’ => false,
‘fields’ => $fields,
‘resolver’ => [
‘className’ => ‘Authentication.Orm’,
‘finder’ => ‘all’,
‘userModel’ => ‘Customers’,
Then in Customers controller implemented login, logout and index action:
The login authenticate form react axios API request on the Customers table.
After login from axios I send /customers request with the Bearer token in the Header request.
Initially the index action give me the error “Users table not found” so I’ve created the table for debugging purpose and the error give up, but now I receive error 401 “Authentication is required to continue”
$identity = $this->Authentication->getIdentity(); return null!

public function index()
$identity = $this->Authentication->getIdentity();
$json = [‘customer’ => $identity->getOriginalData()];
$this->viewBuilder()->setOption(‘serialize’, ‘json’);
$this->RequestHandler->renderAs($this, ‘json’);


I have insert
Debugger::dump($this->Authentication->getResult()); and this is the output

object(Authentication\Authenticator\Result) id:0 {
protected _status => ‘FAILURE_CREDENTIALS_MISSING’
protected _data => null
protected _errors => [
(int) 0 => ‘Login credentials not found’,

When I use table users, all works!!!

The project you’re looking at has much more in its getAuthenticationService function than just the password identifier. If you want your system to work when given JWT tokens, you need to also add the JWT authenticator and identifier, as shown there.

Obviously I’ve report here only the interesting code.
If I switch to users table all works

Well, if you’re trying to do JWT authentication, then the configuration for JWT authentication would seem to me to be interesting. And I don’t see it here, so assumed that you haven’t got it, and that’s why you’re getting 401 errors.

Switching userModel from Customers to Users all works fine.
But If I set userModel to Customers and delete User model I receive after login: table user not exist error.

I think there is a bug in Authentication plugin or in Firebase when userModel isn’t set to users
Thanks for your reply