# Issue loading my Authentication Plugin Class

**URL:** <https://discourse.cakephp.org/t/issue-loading-my-authentication-plugin-class/5863>\
**Category:** Plugins\
**Created:** [March 28, 2019, 2:21am UTC](https://discourse.cakephp.org/t/issue-loading-my-authentication-plugin-class/5863 "2019-03-28T02:21:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dev-ns8](https://avatars.discourse-cdn.com/v4/letter/d/7bcc69/32.png) [@dev-ns8](https://discourse.cakephp.org/u/dev-ns8)\
**Post date:** [March 28, 2019, 2:21am UTC](https://discourse.cakephp.org/t/issue-loading-my-authentication-plugin-class/5863/1 "2019-03-28T02:21:59Z")

</div>

am trying to write a CakePHP Authentication plugin and am following and structuring it after this repository: [https://github.com/ADmad/cakephp-jwt-auth](https://github.com/ADmad/cakephp-jwt-auth)

I am still at the early stages, trying to get my plugin to load during cakePHPs `constructAuthenticate()` method. I have narrowed down my issue to this method never finding my class when it calls `class_exists()`

I have Project structure as follows:

`App/

```
plugins/
src/
    Controller/
        AppController.php
    Model/
vendor/
    Admad/
        cakephp-jwt-auth/
            src/
                Auth/
                    JwtAuthenticate.php
            composer.json
    nates/
        cakephp-total-auth/
            src/
                Auth/
                    TotalAuthenticate.php
   composer.json`

```

`TotalAuthenticate` is the class I’m trying to load, and it’s namespace as defined in `TotalAuthenticate.php` is:

`namespace nates\TotalAuth\auth;`

After some debugging I have found that the Path being passed to `classs_exists()` is:

`nates\TotalAuth\Auth\TotalAuthenticate`

I have compared all of this info to the `Admad/JwtAuth` plugin and the relative paths all match up, and that plugin loads just fine so I’m really at a loss at whats going on here and why my plugin won’t load.

My Autoload in `App/composer.json` Looks as such:

```auto
`"autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Test\\": "tests/",
            "Cake\\Test\\": "vendor/cakephp/cakephp/tests/"
        }
    },`

```

And my Plugins `composer.json` :

```auto
`"autoload": {
    "psr-4": {
      "nates\\TotalAuth\\": "src"
    }
  },
  "autoload-dev": {
    "psr-4": {
// "ADmad\\JwtAuth\\Test\\": "tests"
    }`
```
