Separate Admin login

Hi together,
I created a page where user can login.
This was done by using cakephp Authentication and Authorization. All works fine.
I did it like it is described in tutorial.
And now I added an admin area by using prefix for admin in routes.
But when I try to login right now in Admin area, I get an error

'Login URL `/project/admin/users/login` did not match `/project/users/login`.',

In Application.php I add a function getAuthenticationService (like described in tutorial).
And here I have the unauthenticatedRedirect and loginUrl

public function getAuthenticationService(ServerRequestInterface $request): AuthenticationServiceInterface
    {
        $authenticationService = new AuthenticationService([
            'unauthenticatedRedirect' => Router::url('/users/login'),
            'queryParam' => 'redirect',
        ]);
        
        // Load identifiers, ensure we check email and password fields
        $authenticationService->loadIdentifier('Authentication.Password', [
            'fields' => [
                'username' => 'email',
                'password' => 'password',
            ],
        ]);
        
        // Load the authenticators, you want session first
        $authenticationService->loadAuthenticator('Authentication.Session');
        // Configure form data check to pick email and password
        $authenticationService->loadAuthenticator('Authentication.Form', [
            'fields' => [
                'username' => 'email',
                'password' => 'password',
            ],
            'loginUrl' => Router::url('/users/login'),
        ]);
        return $authenticationService;
    }

Both URLS are showing to the frontend login but not on admin login.
Do I need to create a separate function for Backend? If yes, where should I put it?
And what is about the policies. Do I also have to create some in aditional for Admin?
Maybe someone knows

do you have login function in your admin prefix?

Yes I do have.

public function login()
{
	$this->Authorization->skipAuthorization();
	$this->request->allowMethod(['get', 'post']);
	$result = $this->Authentication->getResult();

	// regardless of POST or GET, redirect if user is logged in
	if ($result && $result->isValid()) {
		return $this->redirect(['action' => 'index']);
	} else {
		$this->Flash->error(__('Benutzername und Passwort sind nicht korrekt'));
	}
}

But problem was before. I guess I solved it.
I am checking now in the getAuthenticationService function if there is an ‘admin’ prefix.
If yes, I will change the URL to admin, if not, I will stay with URL /users/login.
But now I get an error that there is no policy for UserTable.
In Frontend I also have no policy for UsersTable and it works fine.
Question is now, if I need to create some policies for the admin backend too?

looks like you just need to fix your route

$routes->prefix('admin', function (RouteBuilder $routes) {
    $routes->connect('/users/login', ['prefix' => 'Admin', 'controller' => 'Users', 'action' => 'login']);
    $routes->fallbacks(DashedRoute::class);
});

or may be you should make a middleware fot the routes

Usually, people don’t have two separate logins for admin vs normal, they build a role-based thing where everyone logs in the same way, the user record indicates whether they’re an admin or not, and policies and the like give access based on that.

Sorry for giving that late an answer.
I had this idea to create a separate login for Admin from a tutorial.
And I also know this from several CMS or Webshop frameworks.
For example in Joomla you have to login in a separate area which is named /administrator.
Why is it not comming in cakephp?

you need a prefix for that

I fixed the route like you described in your comment.
But the question is still to have a Table policy