SDK and OAuth example bugfixes

* Improves error handling, including a CURL error checking
* Fixes the broken OAuth example