diff --git a/lib/client.js b/lib/client.js index 98344b2..88b2926 100644 --- a/lib/client.js +++ b/lib/client.js @@ -44,6 +44,9 @@ function Client(config) { tokenHost: config.tokenHost, tokenPath: config.tokenPath, }, + options: { + authorizationMethod: 'body' + }, http: { headers: { 'User-Agent': UpworkLibraryUserAgent @@ -139,8 +142,7 @@ Client.prototype.setAccessToken = function(callback) { if (aToken.expired()) { debug('the access token has expired, refreshing'); - aToken.refresh((error, result) => { - aToken = result; + aToken.refresh().then((aToken) => { debug(aToken, 'received a new AccessToken object'); this.config.accessToken = aToken.token.access_token; callback(aToken.token);