# Cakephp 4 authentication

**URL:** <https://discourse.cakephp.org/t/cakephp-4-authentication/11722>\
**Category:** Plugins\
**Created:** [December 1, 2023, 8:23pm UTC](https://discourse.cakephp.org/t/cakephp-4-authentication/11722 "2023-12-01T20:23:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![daryushsa](https://avatars.discourse-cdn.com/v4/letter/d/0ea827/32.png) [@daryushsa](https://discourse.cakephp.org/u/daryushsa)\
**Post date:** [December 1, 2023, 8:23pm UTC](https://discourse.cakephp.org/t/cakephp-4-authentication/11722/1 "2023-12-01T20:23:52Z")

</div>

I tried a lot to solve the authentication in Cake PHP 4, but I couldn’t even when the page link to login template  
I try to see it in the browser, it gives the following error, both Application.php is set and app.php, I also checked autoload in composer.json with GPT chat, but finally it doesn’t give the following error. I know what to do:

**# No authenticators loaded. You need to load at least one authenticator.📋**

RuntimeException

ROOT\vendor\cakephp\authentication\src\Middleware\AuthenticationMiddleware.phpat line68in Authentication\AuthenticationService-\>authenticate(edit)

| | ` {` |
| --- | --- |
| | ` $service = $this->getAuthenticationService($request);` |
| | `` |
| | ` try {` |
| | ` $result = $service->authenticate($request);` |
| | ` } catch (AuthenticationRequiredException $e) {` |
| | ` $body = new Stream('php://memory', 'rw');` |
| | ` $body->write($e->getBody());` |
| | ` $response = new Response();` |

[Toggle Arguments](http://localhost/test_authentication/users/login#)

---

<div class="post-metadata">

**Author:** ![KevinPfeifer](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/kevinpfeifer/32/3365_2.png) [@KevinPfeifer](https://discourse.cakephp.org/u/KevinPfeifer)\
**Post date:** [December 2, 2023, 7:01am UTC](https://discourse.cakephp.org/t/cakephp-4-authentication/11722/2 "2023-12-02T07:01:33Z")

</div>

Have you tried following my workshop?

[![](https://img.youtube.com/vi/EgN_iEVjQIA/maxresdefault.jpg "WORKSHOP - Authentication & Authorization by Kevin Pfeifer") ](https://www.youtube.com/watch?v=EgN_iEVjQIA)

It seems you missed the `getAuthenticationService` part of [Quick Start - 2.x](https://book.cakephp.org/authentication/2/en/index.html#getting-started)
