Handle authentication errors more gracefully.