Unable to register a user “You are not authorized to access that location” message is displayed

in cakephp3 i ame unable to register a user and “You are not authorized to access that location” message is displayed.

In my AppController.php :

public function initialize()
{
parent::initialize();
$this->loadComponent(‘RequestHandler’);
$this->loadComponent(‘Flash’);
$this->loadComponent(‘Auth’, [
‘authorize’ => [‘Controller’],
‘loginRedirect’ => [
‘controller’ => ‘Users’,
‘action’ => ‘index’
],
‘logoutRedirect’ => [
‘controller’ => ‘Users’,
‘action’ => ‘login’,
‘home’
],
]);
}

public function isAuthorized($user)
{
return true;
}

public function beforFilter(Event $event) {
parent::beforeFilter($event);
$this->Auth->allow([‘register’, ‘confirm’, ‘login’]);
}

and in my UsersController.php i have a function register() that i want to call to perform the registration of users.

public function beforFilter(Event $event) {
// your code here
}

must be
public function beforeFilter(Event $event) {
// your code here
}