Change error to 401 for missing basic username. Closes #1148