Changed response status to 417 when credentials are invalid