# Authentication from within a plugin

**URL:** <https://discourse.cakephp.org/t/authentication-from-within-a-plugin/872>\
**Category:** Plugins\
**Created:** [August 2, 2016, 1:23pm UTC](https://discourse.cakephp.org/t/authentication-from-within-a-plugin/872 "2016-08-02T13:23:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![winlite](https://avatars.discourse-cdn.com/v4/letter/w/258eb7/32.png) [@winlite](https://discourse.cakephp.org/u/winlite)\
**Post date:** [August 2, 2016, 1:23pm UTC](https://discourse.cakephp.org/t/authentication-from-within-a-plugin/872/1 "2016-08-02T13:23:45Z")

</div>

I have 3 different Dashboards in my website

Root  
Admin  
Manager

All the there have User authentication. But I want to have only one UsersController which may be placed under the main src/Controller folder.

Now my question is how may a config my auth component in Plugin’s BaseController.  
I am trying like

```
$this->loadComponent('Auth', [
       'authenticate' => [
         'Form' => [
           'fields' => [
             'username' => 'username',
             'password' => 'password'
           ]
         ]
       ],
       'loginAction' => [
         'controller' => 'App\Users',
         'action' => 'login'
       ]
     ]);
```
