So, I was working on the security layer of a Symfony 4 app, as usual, then I started testing the code, when this weird errors message (Authentication Request) popped out of nowhere :

The Error

Authentication request could not be processed due to a system problem.

Naturally, one would head to the  symfony debug bar and the profiler. That’s what I did actually, but no errors whatsoever.

The Logs

Checking the Symfony logs was the next natural thing to do, and the mistake I made was not paying attention to the “info” messages. It turns our that the error was there :

security.INFO: Authentication request failed. {"exception":"[object] (Symfony\\Component\\Security\\Core\\Exception\\AuthenticationServiceException(code: 0): The \"App\\Entity\\User\" entity has a repositoryClass set to \"App\\Entity\\UserRepository\", but this is not a valid class. Check your class naming.

In my case, the error was simply the Doctrine repository class I have specified on the entity was mistaken. Wrong namespace, as I was putting repository classes in a separate repository folder.

The Solution

For this specific error, I think that this line is the one you should first look for :

security.INFO: Authentication request failed.

Leave a comment