Make errorHandler reusable, independent of...

...newRequest.
Polyfill Object.keys, use it in getEditToken