Cakephp 4: Install authentication plugin

Hi,

I’m following the quickstart guide (https://book.cakephp.org/authentication/2/en/index.html).
When installing the plugin using composer, I don’t get an error. The plugin is also mentioned in the composer.json

c omposer require cakephp/authentication
Using version ^2.3 for cakephp/authentication
./composer.json has been updated
Running composer update cakephp/authentication
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
- Locking cakephp/authentication (2.3.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
- Installing cakephp/authentication (2.3.0): Extracting archive
2 package suggestions were added by new dependencies, use composer suggest to see details.
Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested.
Generating autoload files
31 packages you are using are looking for funding.
Use the composer fund command to find out more!

However… nothing is added to the plugins directory. I only find the plugin with the vendors.

find . -name authentication
./vendor/cakephp/authentication

And offcourse, when trying to configurate authentication, I get an error:
Error The application is trying to load a file from the Authenticate plugin.

Make sure your plugin Authenticate is in the <…>plugins/ directory and was loaded.

What am I doing wrong? I would expect that everything is put automatically in the plugins directory?

Thanks for your help!

vendor is the correct place for third-party plugins to go, and it’s in the right place for you. Note that the name of the plugin is “Authentication”; your error messages reference “Authenticate”.

1 Like

You just made my day. The mistake was indeed the typo Authenticate vs Authentication.
:partying_face: :+1:

I have a similar problem and I have the same authentication github download in both vendor and plugins directories but that seems counterintuitive to me. So it’s correct after all to have the same plugin in both folders?

No, third-party plugins should be in the vendor folder only.

Thanks, Zuluru. So what do I put in the plugins folder then? And what does a “third-party” plugin mean? Is it the authentication code that I downloaded from github: GitHub - cakephp/authentication: Authentication plugin for CakePHP. Can also be used in PSR7 based applications.?

Third-party plugin is a plugin written by somebody else. What goes in your plugins folder would be plugins that you write.