We can share a lot of this functionality with auth-errors.js, maybe create a base class and pass in the two mapping objects as configuration?