Cake 4 Authentication Plugin with Admin Prefix

Hi, I am using Authentication plugin 2.0 with cake 4. When I try to login directly from there is not problem.
But trying to login with my Admin prefix
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’]);
’, );

     $builder->scope('/admin', function (RouteBuilder $routes) {


How can I configure the Authentication plugin to work with Admin Prefix please.
Thanks for helping

None of the code you’ve shown is trying to call allowUnauthenticated. Where is that call happening?