Skip to content

Commit

Permalink
fix token refreshing flow
Browse files Browse the repository at this point in the history
  • Loading branch information
mnovozhylov committed Apr 15, 2024
1 parent 0b65b76 commit af56fd7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ function Client(config) {
tokenHost: config.tokenHost,
tokenPath: config.tokenPath,
},
options: {
authorizationMethod: 'body'
},
http: {
headers: {
'User-Agent': UpworkLibraryUserAgent
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit af56fd7

Please sign in to comment.