Q: Silex REST login - How does it work? I'm using Silex for the backend of an angularjs app. I wanna realize an user-authentication. I used this tutorial (http://www.bubblecode.net/en/2012/08/28/mysql-authentication-in-silex-the-php-micro-framework/) and the official documentation to realize it so far. The backend returns pure JSON, no HTML.
My questions:


*

*How do I have to send the login-request? I never get an appropriated 
response, just a 301 redirect. It's the same reponse like I get if I 
try to access a ressource I don't have access.

*The backend always redirects me to the the login route if I don't have access to a page. All I want is an 401. How can I change this behaviour?


Thanks guys! Cheers Chris

A: The call needs to send the parameters _username and _password to the check url.
This is taken from official documentation which can be found here:

The form has very few requirements. First, by submitting the form to
  /login_check (via the login_check route), the security system will
  intercept the form submission and process the form for you
  automatically. Second, the security system expects the submitted
  fields to be called _username and _password (these field names can be
  configured).

For your second question:
You can specifiy a redirect route as described here. 
Then just return 401 as response for this route.
I hope this will help you.
Sorry for my bad english!
