json error handling for the API - needs flash-oauthlib with https://github.com/leifj/flask-oauthlib/commit/875865d0e80b0eb8ace426f8b217fb7266061579 in it