add additional check for invalid token by parsing the JSON response

This is intended to fix [#146](https://github.com/Esri/resource-proxy/issues/146) by parsing the JSON response and checking for error codes there.