Modified the way this was handled, due to handing it via ajax. Please have a look at the main.js file as well - Symfony security would grab the request if user is not logged in and would redirect to login page.