added basic auth error handling