Skip to content

Commit

Permalink
Merge pull request #31 from upwork/v2.2.2
Browse files Browse the repository at this point in the history
fix token refreshing flow
  • Loading branch information
mnovozhylov committed Apr 15, 2024
2 parents 0b65b76 + 82112a8 commit 1983e1c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Release History

## 2.2.2
* Fix issue#29

## 2.2.1
* Fix base url

Expand Down
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@upwork/node-upwork-oauth2",
"description": "Node.JS bindings for Upwork API (OAuth2)",
"version": "2.2.1",
"version": "2.2.2",
"author": {
"name": "Maksym Novozhylov",
"email": "mnovozhilov@upwork.com"
Expand Down

0 comments on commit 1983e1c

Please sign in to comment.