OAuth http exception handling and API oauth bug fix