handling 401 authorization errors to handle basic auth failure