accepts POST request to /login resource and returns json response