0
votes

I have a free installed instance of Cakephp 3.0 with several code examples, everything is working fine. Now I want to create a Auth component in ./src/Auth, concerning the documentation here

Thats my code:

<?php
namespace App\Auth; 
use Cake\Auth\BaseAuthenticate;
class AlephAuthenticate extends BaseAuthenticate
{
    public function authenticate(Request $request, Response $response)
    {
        // Do things for OpenID here.
        // Return an array of user if they could authenticate the user,
        // return false if not.
    }
}

In AppContoller.php I initialize this component:

public function initialize() {
        $this->loadComponent('Auth');
        $this->Auth->config('authenticate', ['Aleph']);
    }

Calling the application URL in the browser shows:

Fatal error: Declaration of App\Auth\AlephAuthenticate::authenticate() must be compatible with Cake\Auth\BaseAuthenticate::authenticate(Cake\Network\Request $request, Cake\Network\Response $response) in /var/www/art/src/Auth/AlephAuthenticate.php on line 7

Any idea whats wrong here?

Thanks!

Christoph

1

1 Answers

0
votes

Please read the error message it is obvious. If you still have trouble understanding it just paste the error message into a search engine. This is the basic procedure for almost every error message if you don't know it and will probably always solve it. Guess it's in the php documentation as well.

Let me rephrase the error message for you: The method signatures don't match. To get rid off the error message make them match.