rest-client-sdk 7.4.0 → 7.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -0
- package/dist/index.cjs +20 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +20 -11
- package/dist/index.mjs.map +1 -1
- package/dist/types/TokenGenerator/AuthorizationCodeFlowTokenGenerator.d.ts +3 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1933,14 +1933,15 @@ var AuthorizationCodeFlowTokenGenerator = /*#__PURE__*/function (_AbstractTokenG
|
|
|
1933
1933
|
headers: {
|
|
1934
1934
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
1935
1935
|
},
|
|
1936
|
-
body: new URLSearchParams({
|
|
1936
|
+
body: new URLSearchParams(_objectSpread2(_objectSpread2({
|
|
1937
1937
|
grant_type: 'authorization_code',
|
|
1938
|
-
client_id: this.tokenGeneratorConfig.clientId
|
|
1939
|
-
|
|
1940
|
-
// TODO : secure this ?
|
|
1938
|
+
client_id: this.tokenGeneratorConfig.clientId
|
|
1939
|
+
}, this._clientSecretParameter()), {}, {
|
|
1941
1940
|
redirect_uri: this.tokenGeneratorConfig.redirectUri,
|
|
1942
1941
|
code: parameters.code
|
|
1943
|
-
}
|
|
1942
|
+
}, parameters.codeVerifier ? {
|
|
1943
|
+
code_verifier: parameters.codeVerifier
|
|
1944
|
+
} : {})).toString()
|
|
1944
1945
|
};
|
|
1945
1946
|
if (this.logger) {
|
|
1946
1947
|
this.logger.logRequest(_objectSpread2({
|
|
@@ -1969,12 +1970,12 @@ var AuthorizationCodeFlowTokenGenerator = /*#__PURE__*/function (_AbstractTokenG
|
|
|
1969
1970
|
headers: {
|
|
1970
1971
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
1971
1972
|
},
|
|
1972
|
-
body: new URLSearchParams({
|
|
1973
|
+
body: new URLSearchParams(_objectSpread2(_objectSpread2({
|
|
1973
1974
|
grant_type: 'refresh_token',
|
|
1974
|
-
client_id: this.tokenGeneratorConfig.clientId
|
|
1975
|
-
|
|
1975
|
+
client_id: this.tokenGeneratorConfig.clientId
|
|
1976
|
+
}, this._clientSecretParameter()), {}, {
|
|
1976
1977
|
refresh_token: oldAccessToken.refresh_token
|
|
1977
|
-
}).toString()
|
|
1978
|
+
})).toString()
|
|
1978
1979
|
};
|
|
1979
1980
|
if (this.logger) {
|
|
1980
1981
|
this.logger.logRequest(_objectSpread2({
|
|
@@ -1992,13 +1993,21 @@ var AuthorizationCodeFlowTokenGenerator = /*#__PURE__*/function (_AbstractTokenG
|
|
|
1992
1993
|
if (!(config.path && config.scheme)) {
|
|
1993
1994
|
throw new RangeError('TokenGenerator config is not valid, it should contain a "path", a "scheme" parameter');
|
|
1994
1995
|
}
|
|
1995
|
-
if (!
|
|
1996
|
-
throw new RangeError('TokenGenerator config is not valid, it should contain a "clientId"
|
|
1996
|
+
if (!config.clientId) {
|
|
1997
|
+
throw new RangeError('TokenGenerator config is not valid, it should contain a "clientId" parameter');
|
|
1997
1998
|
}
|
|
1998
1999
|
if (!config.redirectUri) {
|
|
1999
2000
|
throw new RangeError('TokenGenerator config is not valid, it should contain a "redirectUri" parameter');
|
|
2000
2001
|
}
|
|
2001
2002
|
}
|
|
2003
|
+
}, {
|
|
2004
|
+
key: "_clientSecretParameter",
|
|
2005
|
+
value: function _clientSecretParameter() {
|
|
2006
|
+
var clientSecret = this.tokenGeneratorConfig.clientSecret;
|
|
2007
|
+
return clientSecret ? {
|
|
2008
|
+
client_secret: clientSecret
|
|
2009
|
+
} : {};
|
|
2010
|
+
}
|
|
2002
2011
|
}, {
|
|
2003
2012
|
key: "_checkGenerateParameters",
|
|
2004
2013
|
value: function _checkGenerateParameters(parameters) {
|