kinvey-js-sdk
Advanced tools
Comparing version 6.0.2 to 6.0.3
@@ -6,5 +6,23 @@ # Change Log | ||
## [6.0.3](https://github.com/Kinvey/js-sdk/compare/kinvey-js-sdk@6.0.2...kinvey-js-sdk@6.0.3) (2022-07-14) | ||
### Bug Fixes | ||
* behaviour when refreshing KCS tokens ([a49b215](https://github.com/Kinvey/js-sdk/commit/a49b2151b0730ac0705f2c7a7ae666181935465b)) | ||
* do not save refresh_token returned from _me endpoint ([3201bfa](https://github.com/Kinvey/js-sdk/commit/3201bfae329588f2c59180490defad1a89d7e804)) | ||
## [6.0.2](https://github.com/Kinvey/js-sdk/compare/kinvey-js-sdk@6.0.1...kinvey-js-sdk@6.0.2) (2022-04-28) | ||
- Version bump for package kinvey-js-sdk | ||
## [6.0.1](https://github.com/Kinvey/js-sdk/compare/kinvey-js-sdk@6.0.0...kinvey-js-sdk@6.0.1) (2022-04-20) | ||
@@ -15,2 +33,5 @@ | ||
## [6.0.0](https://github.com/Kinvey/js-sdk/compare/kinvey-js-sdk@5.1.1...kinvey-js-sdk@6.0.0) (2021-07-30) | ||
@@ -29,5 +50,14 @@ | ||
## [5.1.2](https://github.com/Kinvey/js-sdk/compare/kinvey-js-sdk@5.1.1...kinvey-js-sdk@5.1.2) (2022-05-26) | ||
### Bug Fixes | ||
* Fixed an issue with sporadic logouts | ||
## [5.1.1](https://github.com/Kinvey/js-sdk/compare/kinvey-js-sdk@5.1.0...kinvey-js-sdk@5.1.1) (2021-04-12) | ||
### Bug Fixes | ||
@@ -43,3 +73,2 @@ | ||
### Bug Fixes | ||
@@ -51,2 +80,4 @@ | ||
## [5.0.1](https://github.com/Kinvey/js-sdk/compare/kinvey-js-sdk@5.0.0...kinvey-js-sdk@5.0.1) (2020-07-22) | ||
@@ -58,5 +89,6 @@ | ||
# [5.0.0](https://github.com/Kinvey/js-sdk/compare/kinvey-js-sdk@4.2.5...kinvey-js-sdk@5.0.0) (2020-07-10) | ||
### Bug Fixes | ||
@@ -66,3 +98,2 @@ | ||
### Features | ||
@@ -69,0 +100,0 @@ |
@@ -60,3 +60,2 @@ "use strict"; | ||
var log_1 = require("../log"); | ||
var cache_1 = require("../datastore/cache"); | ||
var headers_1 = require("./headers"); | ||
@@ -157,3 +156,3 @@ var http_1 = require("./http"); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var error_1, activeSession, socialIdentity_1, micIdentityKey, micSession_1, refreshRequest, refreshResponse, newMICSession, loginRequest, loginResponse, newSession, request, response, error_2, request, error_3; | ||
var error_1, activeSession, socialIdentity_1, micIdentityKey, micSession_1, refreshRequest, refreshResponse, newMICSession, loginRequest, loginResponse, newSession, request, response, error_2; | ||
var _a; | ||
@@ -170,3 +169,3 @@ var _this = this; | ||
case 2: | ||
_b.trys.push([2, 4, , 21]); | ||
_b.trys.push([2, 4, , 15]); | ||
return [4 /*yield*/, _super.prototype.execute.call(this)]; | ||
@@ -176,4 +175,4 @@ case 3: return [2 /*return*/, _b.sent()]; | ||
error_1 = _b.sent(); | ||
if (!retry) return [3 /*break*/, 20]; | ||
if (!(error_1 instanceof invalidCredentials_1.InvalidCredentialsError)) return [3 /*break*/, 19]; | ||
if (!retry) return [3 /*break*/, 14]; | ||
if (!(error_1 instanceof invalidCredentials_1.InvalidCredentialsError)) return [3 /*break*/, 13]; | ||
if (isRefreshTokenRequestInProgress()) { | ||
@@ -192,8 +191,8 @@ return [2 /*return*/, REQUEST_QUEUE.add(function () { | ||
micIdentityKey = Object.keys(socialIdentity_1).find(function (sessionKey) { return socialIdentity_1[sessionKey].identity === 'kinveyAuth'; }); | ||
if (!micIdentityKey) return [3 /*break*/, 12]; | ||
if (!micIdentityKey) return [3 /*break*/, 13]; | ||
micSession_1 = socialIdentity_1[micIdentityKey]; | ||
if (!micSession_1) return [3 /*break*/, 12]; | ||
if (!micSession_1) return [3 /*break*/, 13]; | ||
_b.label = 6; | ||
case 6: | ||
_b.trys.push([6, 11, , 12]); | ||
_b.trys.push([6, 12, , 13]); | ||
refreshRequest = new KinveyHttpRequest({ | ||
@@ -216,6 +215,12 @@ method: HttpRequestMethod.POST, | ||
}); | ||
return [4 /*yield*/, refreshRequest.execute()]; | ||
return [4 /*yield*/, refreshRequest.execute(false)]; | ||
case 7: | ||
refreshResponse = _b.sent(); | ||
newMICSession = Object.assign({}, micSession_1, refreshResponse.data); | ||
activeSession._socialIdentity[micIdentityKey] = Object.assign({}, activeSession._socialIdentity[micIdentityKey], newMICSession); | ||
// Persist the new access and refresh tokens | ||
return [4 /*yield*/, session_1.setSession(activeSession)]; | ||
case 8: | ||
// Persist the new access and refresh tokens | ||
_b.sent(); | ||
loginRequest = new KinveyHttpRequest({ | ||
@@ -231,4 +236,4 @@ method: HttpRequestMethod.POST, | ||
}); | ||
return [4 /*yield*/, loginRequest.execute()]; | ||
case 8: | ||
return [4 /*yield*/, loginRequest.execute(false)]; | ||
case 9: | ||
loginResponse = _b.sent(); | ||
@@ -239,3 +244,3 @@ newSession = loginResponse.data; | ||
return [4 /*yield*/, session_1.setSession(newSession)]; | ||
case 9: | ||
case 10: | ||
// Set the new session | ||
@@ -245,3 +250,3 @@ _b.sent(); | ||
return [4 /*yield*/, request.execute(false)]; | ||
case 10: | ||
case 11: | ||
response = _b.sent(); | ||
@@ -252,45 +257,14 @@ // Mark the refresh token as complete | ||
return [2 /*return*/, response]; | ||
case 11: | ||
case 12: | ||
error_2 = _b.sent(); | ||
log_1.logger.error(error_2.message); | ||
return [3 /*break*/, 12]; | ||
case 12: | ||
_b.trys.push([12, 18, , 19]); | ||
request = new KinveyHttpRequest({ | ||
method: HttpRequestMethod.POST, | ||
auth: headers_1.KinveyHttpAuth.Session, | ||
url: utils_1.formatKinveyBaasUrl(utils_1.KinveyBaasNamespace.User, '/_logout') | ||
}); | ||
return [4 /*yield*/, request.execute(false)]; | ||
return [3 /*break*/, 13]; | ||
case 13: | ||
_b.sent(); | ||
// Remove the session | ||
return [4 /*yield*/, session_1.removeSession()]; | ||
case 14: | ||
// Remove the session | ||
_b.sent(); | ||
// Clear cache's | ||
return [4 /*yield*/, cache_1.QueryCache.clear()]; | ||
case 15: | ||
// Clear cache's | ||
_b.sent(); | ||
return [4 /*yield*/, cache_1.SyncCache.clear()]; | ||
case 16: | ||
_b.sent(); | ||
return [4 /*yield*/, cache_1.DataStoreCache.clear()]; | ||
case 17: | ||
_b.sent(); | ||
return [3 /*break*/, 19]; | ||
case 18: | ||
error_3 = _b.sent(); | ||
log_1.logger.error(error_3.message); | ||
return [3 /*break*/, 19]; | ||
case 19: | ||
// Mark the refresh token as complete | ||
markRefreshTokenRequestComplete(); | ||
_b.label = 20; | ||
case 20: | ||
_b.label = 14; | ||
case 14: | ||
// Throw the error | ||
throw error_1; | ||
case 21: return [2 /*return*/]; | ||
case 15: return [2 /*return*/]; | ||
} | ||
@@ -297,0 +271,0 @@ }); |
@@ -167,5 +167,5 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var request, response, data; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
var request, response, data, _a; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
@@ -180,19 +180,25 @@ request = new http_1.KinveyHttpRequest({ | ||
case 1: | ||
response = _a.sent(); | ||
response = _b.sent(); | ||
data = response.data; | ||
// Remove sensitive data | ||
delete data.password; | ||
// Merge _socialIdentity | ||
if (data._socialIdentity) { | ||
data._socialIdentity = utils_1.mergeSocialIdentity(this._socialIdentity, data._socialIdentity); | ||
if (!data._socialIdentity) return [3 /*break*/, 3]; | ||
_a = this; | ||
return [4 /*yield*/, http_1.getSession()]; | ||
case 2: | ||
_a.data = _b.sent(); | ||
if (data._socialIdentity.kinveyAuth) { | ||
delete data._socialIdentity.kinveyAuth.refresh_token; | ||
} | ||
return [4 /*yield*/, this.isActive()]; | ||
case 2: | ||
if (!_a.sent()) return [3 /*break*/, 4]; | ||
data._socialIdentity = utils_1.mergeSocialIdentity(this._socialIdentity, data._socialIdentity); | ||
_b.label = 3; | ||
case 3: return [4 /*yield*/, this.isActive()]; | ||
case 4: | ||
if (!_b.sent()) return [3 /*break*/, 6]; | ||
data._kmd.authtoken = this.authtoken; | ||
return [4 /*yield*/, http_1.setSession(data)]; | ||
case 3: | ||
_a.sent(); | ||
_a.label = 4; | ||
case 4: | ||
case 5: | ||
_b.sent(); | ||
_b.label = 6; | ||
case 6: | ||
this.data = data; | ||
@@ -199,0 +205,0 @@ return [2 /*return*/, this]; |
{ | ||
"name": "kinvey-js-sdk", | ||
"description": "Kinvey JavaScript SDK for JavaScript applications.", | ||
"version": "6.0.2", | ||
"version": "6.0.3", | ||
"license": "Apache-2.0", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
755700
11742