Improved interface for get-token and post-request.