Symfony security return 401 response instead of redirect
I'm writing an ajax application with ajax authentication and now I started using the symfony security component in silex to handle authentication/authorization. Doing a simple test with a simple configuration, I go to a protected area by the firewall and the response I get is a redirection to the /login page but what I need in my app is a 401 response with possible additional information(in headers or json body) on how to login. $app['security.firewalls'] = [ 'api' => [ 'pattern' => '^/api', 'logout' => ['logout_path'=>'/auth/logout'], 'users' => $app->share(function(Application $app) { return