From 6cc2fdaf622e6ebe713a1953c51d97eed27f1a89 Mon Sep 17 00:00:00 2001 From: Przemyslaw Motacki Date: Thu, 2 Nov 2023 16:39:00 +0100 Subject: [PATCH] Fix token-request in retry strategy. (#685) --- lib/services/sf.js | 13 ++++++++----- lib/util.js | 2 +- test/unit/util_test.js | 12 +----------- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/lib/services/sf.js b/lib/services/sf.js index 2ebfa0664..c805b393d 100644 --- a/lib/services/sf.js +++ b/lib/services/sf.js @@ -1478,11 +1478,14 @@ StateRenewing.prototype.enter = function (context) { method: 'POST', url: '/session/token-request', - json: - { - 'REQUEST_TYPE': 'RENEW', - 'oldSessionToken': this.tokenInfo.getSessionToken() - }, + headers: { + CLIENT_APP_ID: this.connectionConfig.getClientType(), + CLIENT_APP_VERSION: this.connectionConfig.getClientVersion(), + }, + json: { + 'REQUEST_TYPE': 'RENEW', + 'oldSessionToken': this.tokenInfo.getSessionToken(), + }, scope: this, callback: function (err, body) { diff --git a/lib/util.js b/lib/util.js index 4deb72c7b..59674b0e9 100644 --- a/lib/util.js +++ b/lib/util.js @@ -473,7 +473,7 @@ exports.getNextSleepTime = getNextSleepTime; * @returns {Boolean} true if it is loginRequest, otherwise false. */ exports.isLoginRequest = function (loginUrl) { - const endPoints = ['/v1/login-request', '/authenticator-request', '/token-request',]; + const endPoints = ['/v1/login-request', '/authenticator-request']; return endPoints.some((endPoint) => loginUrl.includes(endPoint)); } diff --git a/test/unit/util_test.js b/test/unit/util_test.js index 8b90a4683..05859ef51 100644 --- a/test/unit/util_test.js +++ b/test/unit/util_test.js @@ -545,17 +545,7 @@ describe('Util', function () testName: 'test URL with a wrong authenticator-request point', endPoint: '/authenticator-requ', result:false, - }, - { - testName: 'test URL with a right token point', - endPoint: '/token-request', - result:true, - }, - { - testName: 'test URL with a wrong token point', - endPoint: '/tokenRequest', - result:false, - }, + } ]; for (const {testName, endPoint,result} of testCases)