Improved handling authentication failure to render a customized response