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

**URL:** <https://discourse.cakephp.org/t/unable-to-register-a-user-you-are-not-authorized-to-access-that-location-message-is-displayed/2861>\
**Category:** Need Help\
**Created:** [July 9, 2017, 5:50pm UTC](https://discourse.cakephp.org/t/unable-to-register-a-user-you-are-not-authorized-to-access-that-location-message-is-displayed/2861 "2017-07-09T17:50:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![khalid](https://avatars.discourse-cdn.com/v4/letter/k/aeb1de/32.png) [@khalid](https://discourse.cakephp.org/u/khalid)\
**Post date:** [July 9, 2017, 5:50pm UTC](https://discourse.cakephp.org/t/unable-to-register-a-user-you-are-not-authorized-to-access-that-location-message-is-displayed/2861/1 "2017-07-09T17:50:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![juliarnasution](https://avatars.discourse-cdn.com/v4/letter/j/e9bcb4/32.png) [@juliarnasution](https://discourse.cakephp.org/u/juliarnasution)\
**Post date:** [July 10, 2017, 4:02am UTC](https://discourse.cakephp.org/t/unable-to-register-a-user-you-are-not-authorized-to-access-that-location-message-is-displayed/2861/2 "2017-07-10T04:02:16Z")

</div>

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

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