Add logging of requests with token that fail

Also fix a few tests that I found were failing...
These are mainly due to the wrong decoding
of json data!