Pull cookie values properly and send login errors as json