Add option to refresh_token for different platform

* Fix issue with oauth_token on request header after refresh.
* Code cleanup.