Hi, I am using Authentication plugin 2.0 with cake 4. When I try to login directly from www.project.com/login there is not problem.
But trying to login with my Admin prefix
www.project.com/Admin/login
I get error
“Call to a member function allowUnauthenticated() on null”
my route:
$routes->scope (‘/’, function (RouteBuilder $builder) {
$builder->prefix( ‘admin’, function (RouteBuilder $routes) {
$routes->connect(‘/’, [‘controller’ => ‘Users’, ‘action’ => ‘login’]);
$routes->connect(‘/users/{id}/‘, [‘controller’ => ‘Users’, ‘action’ => ‘login’]);
$routes->connect(’/:controller/:action/’, );
$routes->fallbacks(DashedRoute::class);
}
);
$builder->scope('/admin', function (RouteBuilder $routes) {
$routes->loadPlugin('Authentication');
});
});
How can I configure the Authentication plugin to work with Admin Prefix please.
Thanks for helping