Site with cakedc users 9 gives error err_too_many_redirects in cakephp 4.2

When I login the site saves the cookie and then it gives the error err_too_many_redirects, it doesn´t show the looged in page, and when the cookie is created I can’t enter to the site because it gives the error, because is trying to redirect to the login action of the cakedc users plugin and then to the root without the login action.
This is the screenshot of the error:


How can I solve this error?

This means you are trying to access a page which is not allowed to be accessed without being logged in.

If you copied the cakedc/users/config/permissions.php to your own config folder make sure you allow the default login action for non authenticated users.

Thats why there is the bypassAuth flag set users/permissions.php at master · CakeDC/users · GitHub

I have that, this is the code of cakedc/users/config/permissions.php

return [
    'CakeDC/Auth.permissions' => [
        //all bypass
        [
            'prefix' => false,
            'plugin' => 'CakeDC/Users',
            'controller' => 'Users',
            'action' => [
                // LoginTrait
                'socialLogin',
                'login',
                'logout',
                'socialEmail',
                'verify',
                // RegisterTrait
                'register',
                'validateEmail',
                // PasswordManagementTrait used in RegisterTrait
                'changePassword',
                'resetPassword',
                'requestResetPassword',
                // UserValidationTrait used in PasswordManagementTrait
                'resendTokenValidation',
                'linkSocial',
                //U2F actions
                'u2f',
                'u2fRegister',
                'u2fRegisterFinish',
                'u2fAuthenticate',
                'u2fAuthenticateFinish',
            ],
            'bypassAuth' => true,
        ],
        [
            'prefix' => false,
            'plugin' => 'CakeDC/Users',
            'controller' => 'SocialAccounts',
            'action' => [
                'validateAccount',
                'resendValidation',
            ],
            'bypassAuth' => true,
        ],
        //admin role allowed to all the things
        [
            'role' => 'admin',
            'prefix' => '*',
            'extension' => '*',
            'plugin' => '*',
            'controller' => '*',
            'action' => '*',
        ],
        //specific actions allowed for the all roles in Users plugin
        [
            'role' => '*',
            'plugin' => 'CakeDC/Users',
            'controller' => 'Users',
            'action' => ['profile', 'logout', 'linkSocial', 'callbackLinkSocial'],
        ],
        [
            'role' => '*',
            'plugin' => 'CakeDC/Users',
            'controller' => 'Users',
            'action' => 'resetOneTimePasswordAuthenticator',
            'allowed' => function (array $user, $role, \Cake\Http\ServerRequest $request) {
                $userId = \Cake\Utility\Hash::get($request->getAttribute('params'), 'pass.0');
                if (!empty($userId) && !empty($user)) {
                    return $userId === $user['id'];
                }

                return false;
            }
        ],
        //all roles allowed to Pages/display
        [
            'role' => '*',
            'controller' => 'Pages',
            'action' => 'display',
        ],
    ]
];

Try clearing your cache via bin/cake cache clear_all

Is a hosting service and I don’t have access to the linux console, is there another way to solve this?

How are you planing to do cakephp updates via composer if you don’t have access to the CLI?

Anyways, the DebugKit has a Cache Tab where you can manually clear all cache configs.

I discovered what is happening, the problem is that I didn’t configure the file permissions.php with the role ‘user’, how can I configure that role to access a page with an authenticated user?

What role do I have to put in permissions.php for a user that has role “user” in users table?