Help Authentication

Hello,

My problem is ‘AuthenticationServiceProviderInterface’.

I installed ‘cakephp/authentication’ with composer but without success.

Can you help me?

Thanks

I think you didn’t installed properly or not follows the all steps in documentation.

I followed each step of the tutorial in the documentation, authentication seems to be well installed (it is in the composer.json).

Unable to load component in file: AppController.php.

I don’t understand…

Can you provide an error or more insight?

I’m using this with success in a Plugin.php, your bootstrap for Application.php will be similar enough:

    public function bootstrap(PluginApplicationInterface $app): void
    {
        parent::bootstrap($app);

        $app->addPlugin('Authentication');
    }
   public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue
    {
        $middlewareQueue->add(new AuthenticationMiddleware($this));

        return $middlewareQueue;
    }
    public function getAuthenticationService(ServerRequestInterface $request): AuthenticationServiceInterface
    {
        $service = new AuthenticationService();
        $service->loadAuthenticator('Authentication.Token', [
            'header' => 'API-KEY',
        ]);

        // Load identifiers
        $service->loadIdentifier('Authentication.Token',[
            'resolver' => 'AdminApi\Identifier\Resolver\CustomResolver'
        ]);

        return $service;
    }