Support unicode json responses

Expiring tokens weren't being handled because the response type comparison was failing. This fix now handles token expiration correctly.