patch authenticate to return json as middleware does not work as expected with express 4.X