authscape 1.0.656 → 1.0.658
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/index.js
CHANGED
|
@@ -85,7 +85,7 @@ function AuthScapeApp(_ref) {
|
|
|
85
85
|
case 5:
|
|
86
86
|
codeVerifier = window.localStorage.getItem("verifier");
|
|
87
87
|
if (!(queryCode != null && codeVerifier != null)) {
|
|
88
|
-
_context.next =
|
|
88
|
+
_context.next = 28;
|
|
89
89
|
break;
|
|
90
90
|
}
|
|
91
91
|
headers = {
|
|
@@ -108,25 +108,30 @@ function AuthScapeApp(_ref) {
|
|
|
108
108
|
response = _context.sent;
|
|
109
109
|
domainHost = window.location.hostname.split('.').slice(-2).join('.');
|
|
110
110
|
window.localStorage.removeItem("verifier");
|
|
111
|
-
|
|
111
|
+
_context.next = 17;
|
|
112
|
+
return _jsCookie["default"].set('access_token', response.data.access_token, {
|
|
112
113
|
maxAge: 2147483647,
|
|
113
114
|
path: '/',
|
|
114
115
|
domain: domainHost,
|
|
115
116
|
secure: true
|
|
116
117
|
});
|
|
117
|
-
|
|
118
|
+
case 17:
|
|
119
|
+
_context.next = 19;
|
|
120
|
+
return _jsCookie["default"].set('expires_in', response.data.expires_in, {
|
|
118
121
|
maxAge: 2147483647,
|
|
119
122
|
path: '/',
|
|
120
123
|
domain: domainHost,
|
|
121
124
|
secure: true
|
|
122
125
|
});
|
|
123
|
-
|
|
126
|
+
case 19:
|
|
127
|
+
_context.next = 21;
|
|
128
|
+
return _jsCookie["default"].set('refresh_token', response.data.refresh_token, {
|
|
124
129
|
maxAge: 2147483647,
|
|
125
130
|
path: '/',
|
|
126
131
|
domain: domainHost,
|
|
127
132
|
secure: true
|
|
128
133
|
});
|
|
129
|
-
|
|
134
|
+
case 21:
|
|
130
135
|
// await setCookie(null, "access_token", response.data.access_token,
|
|
131
136
|
// {
|
|
132
137
|
// maxAge: 2147483647,
|
|
@@ -134,7 +139,6 @@ function AuthScapeApp(_ref) {
|
|
|
134
139
|
// domain: domainHost,
|
|
135
140
|
// secure: true
|
|
136
141
|
// });
|
|
137
|
-
|
|
138
142
|
// await setCookie(null, "expires_in", response.data.expires_in,
|
|
139
143
|
// {
|
|
140
144
|
// maxAge: 2147483647,
|
|
@@ -142,7 +146,6 @@ function AuthScapeApp(_ref) {
|
|
|
142
146
|
// domain: domainHost,
|
|
143
147
|
// secure: true
|
|
144
148
|
// });
|
|
145
|
-
|
|
146
149
|
// await setCookie(null, "refresh_token", response.data.refresh_token,
|
|
147
150
|
// {
|
|
148
151
|
// maxAge: 2147483647,
|
|
@@ -157,16 +160,16 @@ function AuthScapeApp(_ref) {
|
|
|
157
160
|
} else {
|
|
158
161
|
window.location.href = "/";
|
|
159
162
|
}
|
|
160
|
-
_context.next =
|
|
163
|
+
_context.next = 28;
|
|
161
164
|
break;
|
|
162
|
-
case
|
|
163
|
-
_context.prev =
|
|
165
|
+
case 26:
|
|
166
|
+
_context.prev = 26;
|
|
164
167
|
_context.t0 = _context["catch"](9);
|
|
165
|
-
case
|
|
168
|
+
case 28:
|
|
166
169
|
case "end":
|
|
167
170
|
return _context.stop();
|
|
168
171
|
}
|
|
169
|
-
}, _callee, null, [[9,
|
|
172
|
+
}, _callee, null, [[9, 26]]);
|
|
170
173
|
}));
|
|
171
174
|
return function signInValidator(_x2) {
|
|
172
175
|
return _ref2.apply(this, arguments);
|
|
@@ -8396,26 +8399,41 @@ var setupDefaultOptions = /*#__PURE__*/function () {
|
|
|
8396
8399
|
case 0:
|
|
8397
8400
|
ctx = _args.length > 0 && _args[0] !== undefined ? _args[0] : null;
|
|
8398
8401
|
defaultOptions = {};
|
|
8399
|
-
if (ctx == null) {
|
|
8400
|
-
|
|
8401
|
-
|
|
8402
|
-
|
|
8403
|
-
|
|
8404
|
-
|
|
8405
|
-
|
|
8406
|
-
|
|
8407
|
-
|
|
8408
|
-
|
|
8409
|
-
|
|
8410
|
-
|
|
8411
|
-
|
|
8402
|
+
if (!(ctx == null)) {
|
|
8403
|
+
_context.next = 12;
|
|
8404
|
+
break;
|
|
8405
|
+
}
|
|
8406
|
+
_context.next = 5;
|
|
8407
|
+
return _jsCookie["default"].get('access_token');
|
|
8408
|
+
case 5:
|
|
8409
|
+
_context.t0 = _context.sent;
|
|
8410
|
+
if (_context.t0) {
|
|
8411
|
+
_context.next = 8;
|
|
8412
|
+
break;
|
|
8413
|
+
}
|
|
8414
|
+
_context.t0 = '';
|
|
8415
|
+
case 8:
|
|
8416
|
+
accessToken = _context.t0;
|
|
8417
|
+
if (accessToken !== null && accessToken !== undefined && accessToken != "") {
|
|
8418
|
+
defaultOptions = {
|
|
8419
|
+
headers: {
|
|
8420
|
+
Authorization: "Bearer " + accessToken
|
|
8421
|
+
}
|
|
8422
|
+
};
|
|
8412
8423
|
} else {
|
|
8413
8424
|
defaultOptions = {
|
|
8414
8425
|
headers: {}
|
|
8415
8426
|
};
|
|
8416
8427
|
}
|
|
8428
|
+
_context.next = 13;
|
|
8429
|
+
break;
|
|
8430
|
+
case 12:
|
|
8431
|
+
defaultOptions = {
|
|
8432
|
+
headers: {}
|
|
8433
|
+
};
|
|
8434
|
+
case 13:
|
|
8417
8435
|
return _context.abrupt("return", defaultOptions);
|
|
8418
|
-
case
|
|
8436
|
+
case 14:
|
|
8419
8437
|
case "end":
|
|
8420
8438
|
return _context.stop();
|
|
8421
8439
|
}
|
|
@@ -8431,9 +8449,29 @@ var RefreshToken = /*#__PURE__*/function () {
|
|
|
8431
8449
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
8432
8450
|
while (1) switch (_context2.prev = _context2.next) {
|
|
8433
8451
|
case 0:
|
|
8434
|
-
|
|
8435
|
-
|
|
8436
|
-
|
|
8452
|
+
_context2.next = 2;
|
|
8453
|
+
return _jsCookie["default"].get('access_token');
|
|
8454
|
+
case 2:
|
|
8455
|
+
_context2.t0 = _context2.sent;
|
|
8456
|
+
if (_context2.t0) {
|
|
8457
|
+
_context2.next = 5;
|
|
8458
|
+
break;
|
|
8459
|
+
}
|
|
8460
|
+
_context2.t0 = '';
|
|
8461
|
+
case 5:
|
|
8462
|
+
accessToken = _context2.t0;
|
|
8463
|
+
_context2.next = 8;
|
|
8464
|
+
return _jsCookie["default"].get('refresh_token');
|
|
8465
|
+
case 8:
|
|
8466
|
+
_context2.t1 = _context2.sent;
|
|
8467
|
+
if (_context2.t1) {
|
|
8468
|
+
_context2.next = 11;
|
|
8469
|
+
break;
|
|
8470
|
+
}
|
|
8471
|
+
_context2.t1 = '';
|
|
8472
|
+
case 11:
|
|
8473
|
+
refreshToken = _context2.t1;
|
|
8474
|
+
_context2.next = 14;
|
|
8437
8475
|
return instance.post(process.env.authorityUri + "/connect/token", _queryString["default"].stringify({
|
|
8438
8476
|
grant_type: 'refresh_token',
|
|
8439
8477
|
client_id: process.env.client_id,
|
|
@@ -8445,55 +8483,38 @@ var RefreshToken = /*#__PURE__*/function () {
|
|
|
8445
8483
|
"Authorization": "Bearer " + accessToken
|
|
8446
8484
|
}
|
|
8447
8485
|
});
|
|
8448
|
-
case
|
|
8486
|
+
case 14:
|
|
8449
8487
|
response = _context2.sent;
|
|
8450
|
-
if (response != null && response.status == 200) {
|
|
8451
|
-
|
|
8452
|
-
|
|
8453
|
-
_jsCookie["default"].set('access_token', response.data.access_token, {
|
|
8454
|
-
maxAge: 2147483647,
|
|
8455
|
-
path: '/',
|
|
8456
|
-
domain: domainHost,
|
|
8457
|
-
secure: true
|
|
8458
|
-
});
|
|
8459
|
-
_jsCookie["default"].set('expires_in', response.data.expires_in, {
|
|
8460
|
-
maxAge: 2147483647,
|
|
8461
|
-
path: '/',
|
|
8462
|
-
domain: domainHost,
|
|
8463
|
-
secure: true
|
|
8464
|
-
});
|
|
8465
|
-
_jsCookie["default"].set('refresh_token', response.data.refresh_token, {
|
|
8466
|
-
maxAge: 2147483647,
|
|
8467
|
-
path: '/',
|
|
8468
|
-
domain: domainHost,
|
|
8469
|
-
secure: true
|
|
8470
|
-
});
|
|
8471
|
-
|
|
8472
|
-
// await setCookie(null, "access_token", response.data.access_token,
|
|
8473
|
-
// {
|
|
8474
|
-
// maxAge: 2147483647,
|
|
8475
|
-
// path: '/',
|
|
8476
|
-
// domain: domainHost,
|
|
8477
|
-
// secure: true
|
|
8478
|
-
// });
|
|
8479
|
-
|
|
8480
|
-
// await setCookie(null, "expires_in", response.data.expires_in,
|
|
8481
|
-
// {
|
|
8482
|
-
// maxAge: 2147483647,
|
|
8483
|
-
// path: '/',
|
|
8484
|
-
// domain: domainHost,
|
|
8485
|
-
// secure: true
|
|
8486
|
-
// });
|
|
8487
|
-
|
|
8488
|
-
// await setCookie(null, "refresh_token", response.data.refresh_token,
|
|
8489
|
-
// {
|
|
8490
|
-
// maxAge: 2147483647,
|
|
8491
|
-
// path: '/',
|
|
8492
|
-
// domain: domainHost,
|
|
8493
|
-
// secure: true
|
|
8494
|
-
// });
|
|
8488
|
+
if (!(response != null && response.status == 200)) {
|
|
8489
|
+
_context2.next = 24;
|
|
8490
|
+
break;
|
|
8495
8491
|
}
|
|
8496
|
-
|
|
8492
|
+
domainHost = window.location.hostname.split('.').slice(-2).join('.');
|
|
8493
|
+
originalRequest.headers['Authorization'] = 'Bearer ' + response.data.access_token;
|
|
8494
|
+
_context2.next = 20;
|
|
8495
|
+
return _jsCookie["default"].set('access_token', response.data.access_token, {
|
|
8496
|
+
maxAge: 2147483647,
|
|
8497
|
+
path: '/',
|
|
8498
|
+
domain: domainHost,
|
|
8499
|
+
secure: true
|
|
8500
|
+
});
|
|
8501
|
+
case 20:
|
|
8502
|
+
_context2.next = 22;
|
|
8503
|
+
return _jsCookie["default"].set('expires_in', response.data.expires_in, {
|
|
8504
|
+
maxAge: 2147483647,
|
|
8505
|
+
path: '/',
|
|
8506
|
+
domain: domainHost,
|
|
8507
|
+
secure: true
|
|
8508
|
+
});
|
|
8509
|
+
case 22:
|
|
8510
|
+
_context2.next = 24;
|
|
8511
|
+
return _jsCookie["default"].set('refresh_token', response.data.refresh_token, {
|
|
8512
|
+
maxAge: 2147483647,
|
|
8513
|
+
path: '/',
|
|
8514
|
+
domain: domainHost,
|
|
8515
|
+
secure: true
|
|
8516
|
+
});
|
|
8517
|
+
case 24:
|
|
8497
8518
|
case "end":
|
|
8498
8519
|
return _context2.stop();
|
|
8499
8520
|
}
|
|
@@ -8526,7 +8547,7 @@ var apiService = function apiService() {
|
|
|
8526
8547
|
case 0:
|
|
8527
8548
|
originalConfig = error.config;
|
|
8528
8549
|
if (!error.response) {
|
|
8529
|
-
_context3.next =
|
|
8550
|
+
_context3.next = 17;
|
|
8530
8551
|
break;
|
|
8531
8552
|
}
|
|
8532
8553
|
if (!(error.response.status === 401 && !originalConfig._retry)) {
|
|
@@ -8542,50 +8563,36 @@ var apiService = function apiService() {
|
|
|
8542
8563
|
return _context3.abrupt("return", instance.request(originalConfig));
|
|
8543
8564
|
case 7:
|
|
8544
8565
|
if (!(error.response.status === 400)) {
|
|
8545
|
-
_context3.next =
|
|
8566
|
+
_context3.next = 17;
|
|
8546
8567
|
break;
|
|
8547
8568
|
}
|
|
8548
|
-
|
|
8549
|
-
|
|
8550
|
-
|
|
8551
|
-
|
|
8552
|
-
|
|
8553
|
-
|
|
8554
|
-
|
|
8555
|
-
|
|
8556
|
-
|
|
8557
|
-
|
|
8558
|
-
|
|
8559
|
-
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
|
|
8563
|
-
|
|
8564
|
-
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
|
|
8570
|
-
|
|
8571
|
-
// });
|
|
8572
|
-
|
|
8573
|
-
// destroyCookie(null, "refresh_token", {
|
|
8574
|
-
// maxAge: 2147483647,
|
|
8575
|
-
// path: '/',
|
|
8576
|
-
// domain: domainHost
|
|
8577
|
-
// });
|
|
8578
|
-
|
|
8579
|
-
// destroyCookie(null, "expires_in", {
|
|
8580
|
-
// maxAge: 2147483647,
|
|
8581
|
-
// path: '/',
|
|
8582
|
-
// domain: domainHost
|
|
8583
|
-
// });
|
|
8584
|
-
}
|
|
8569
|
+
if (!error.response.config.url.includes("/connect/token")) {
|
|
8570
|
+
_context3.next = 16;
|
|
8571
|
+
break;
|
|
8572
|
+
}
|
|
8573
|
+
domainHost = window.location.hostname.split('.').slice(-2).join('.');
|
|
8574
|
+
_context3.next = 12;
|
|
8575
|
+
return _jsCookie["default"].remove('access_token', {
|
|
8576
|
+
path: '/',
|
|
8577
|
+
domain: domainHost
|
|
8578
|
+
});
|
|
8579
|
+
case 12:
|
|
8580
|
+
_context3.next = 14;
|
|
8581
|
+
return _jsCookie["default"].remove('refresh_token', {
|
|
8582
|
+
path: '/',
|
|
8583
|
+
domain: domainHost
|
|
8584
|
+
});
|
|
8585
|
+
case 14:
|
|
8586
|
+
_context3.next = 16;
|
|
8587
|
+
return _jsCookie["default"].remove('expires_in', {
|
|
8588
|
+
path: '/',
|
|
8589
|
+
domain: domainHost
|
|
8590
|
+
});
|
|
8591
|
+
case 16:
|
|
8585
8592
|
return _context3.abrupt("return", Promise.reject(error));
|
|
8586
|
-
case
|
|
8593
|
+
case 17:
|
|
8587
8594
|
return _context3.abrupt("return", Promise.reject(error));
|
|
8588
|
-
case
|
|
8595
|
+
case 18:
|
|
8589
8596
|
case "end":
|
|
8590
8597
|
return _context3.stop();
|
|
8591
8598
|
}
|
|
@@ -9128,19 +9135,24 @@ var authService = function authService() {
|
|
|
9128
9135
|
redirectUri = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : null;
|
|
9129
9136
|
domainHost = window.location.hostname.split('.').slice(-2).join('.');
|
|
9130
9137
|
AuthUri = process.env.authorityUri;
|
|
9131
|
-
|
|
9138
|
+
_context6.next = 5;
|
|
9139
|
+
return _jsCookie["default"].remove('access_token', {
|
|
9132
9140
|
path: '/',
|
|
9133
9141
|
domain: domainHost
|
|
9134
9142
|
});
|
|
9135
|
-
|
|
9143
|
+
case 5:
|
|
9144
|
+
_context6.next = 7;
|
|
9145
|
+
return _jsCookie["default"].remove('refresh_token', {
|
|
9136
9146
|
path: '/',
|
|
9137
9147
|
domain: domainHost
|
|
9138
9148
|
});
|
|
9139
|
-
|
|
9149
|
+
case 7:
|
|
9150
|
+
_context6.next = 9;
|
|
9151
|
+
return _jsCookie["default"].remove('expires_in', {
|
|
9140
9152
|
path: '/',
|
|
9141
9153
|
domain: domainHost
|
|
9142
9154
|
});
|
|
9143
|
-
|
|
9155
|
+
case 9:
|
|
9144
9156
|
// destroyCookie({}, "access_token", {
|
|
9145
9157
|
// maxAge: 2147483647,
|
|
9146
9158
|
// path: '/',
|
|
@@ -9166,7 +9178,7 @@ var authService = function authService() {
|
|
|
9166
9178
|
window.location.href = AuthUri + "/connect/logout?redirect=" + redirectUri;
|
|
9167
9179
|
}
|
|
9168
9180
|
}, 500);
|
|
9169
|
-
case
|
|
9181
|
+
case 10:
|
|
9170
9182
|
case "end":
|
|
9171
9183
|
return _context6.stop();
|
|
9172
9184
|
}
|
|
@@ -9277,7 +9289,7 @@ var signInValidator = /*#__PURE__*/function () {
|
|
|
9277
9289
|
case 0:
|
|
9278
9290
|
codeVerifier = window.localStorage.getItem("verifier");
|
|
9279
9291
|
if (!(queryCode != null && codeVerifier != null)) {
|
|
9280
|
-
_context.next =
|
|
9292
|
+
_context.next = 18;
|
|
9281
9293
|
break;
|
|
9282
9294
|
}
|
|
9283
9295
|
headers = {
|
|
@@ -9299,25 +9311,30 @@ var signInValidator = /*#__PURE__*/function () {
|
|
|
9299
9311
|
response = _context.sent;
|
|
9300
9312
|
domainHost = window.location.hostname.split('.').slice(-2).join('.');
|
|
9301
9313
|
window.localStorage.removeItem("verifier");
|
|
9302
|
-
|
|
9314
|
+
_context.next = 11;
|
|
9315
|
+
return _jsCookie["default"].set('access_token', response.data.access_token, {
|
|
9303
9316
|
maxAge: 2147483647,
|
|
9304
9317
|
path: '/',
|
|
9305
9318
|
domain: domainHost,
|
|
9306
9319
|
secure: true
|
|
9307
9320
|
});
|
|
9308
|
-
|
|
9321
|
+
case 11:
|
|
9322
|
+
_context.next = 13;
|
|
9323
|
+
return _jsCookie["default"].set('expires_in', response.data.expires_in, {
|
|
9309
9324
|
maxAge: 2147483647,
|
|
9310
9325
|
path: '/',
|
|
9311
9326
|
domain: domainHost,
|
|
9312
9327
|
secure: true
|
|
9313
9328
|
});
|
|
9314
|
-
|
|
9329
|
+
case 13:
|
|
9330
|
+
_context.next = 15;
|
|
9331
|
+
return _jsCookie["default"].set('refresh_token', response.data.refresh_token, {
|
|
9315
9332
|
maxAge: 2147483647,
|
|
9316
9333
|
path: '/',
|
|
9317
9334
|
domain: domainHost,
|
|
9318
9335
|
secure: true
|
|
9319
9336
|
});
|
|
9320
|
-
|
|
9337
|
+
case 15:
|
|
9321
9338
|
// await setCookie(null, "access_token", response.data.access_token,
|
|
9322
9339
|
// {
|
|
9323
9340
|
// maxAge: 2147483647,
|
|
@@ -9325,7 +9342,6 @@ var signInValidator = /*#__PURE__*/function () {
|
|
|
9325
9342
|
// domain: domainHost,
|
|
9326
9343
|
// secure: true
|
|
9327
9344
|
// });
|
|
9328
|
-
|
|
9329
9345
|
// await setCookie(null, "expires_in", response.data.expires_in,
|
|
9330
9346
|
// {
|
|
9331
9347
|
// maxAge: 2147483647,
|
|
@@ -9333,7 +9349,6 @@ var signInValidator = /*#__PURE__*/function () {
|
|
|
9333
9349
|
// domain: domainHost,
|
|
9334
9350
|
// secure: true
|
|
9335
9351
|
// });
|
|
9336
|
-
|
|
9337
9352
|
// await setCookie(null, "refresh_token", response.data.refresh_token,
|
|
9338
9353
|
// {
|
|
9339
9354
|
// maxAge: 2147483647,
|
|
@@ -9348,7 +9363,7 @@ var signInValidator = /*#__PURE__*/function () {
|
|
|
9348
9363
|
} else {
|
|
9349
9364
|
window.location.href = "/";
|
|
9350
9365
|
}
|
|
9351
|
-
case
|
|
9366
|
+
case 18:
|
|
9352
9367
|
case "end":
|
|
9353
9368
|
return _context.stop();
|
|
9354
9369
|
}
|
package/package.json
CHANGED
|
@@ -69,21 +69,21 @@ export function AuthScapeApp ({Component, layout, loadingLayout, pageProps, muiT
|
|
|
69
69
|
let domainHost = window.location.hostname.split('.').slice(-2).join('.');
|
|
70
70
|
window.localStorage.removeItem("verifier");
|
|
71
71
|
|
|
72
|
-
Cookies.set('access_token', response.data.access_token, {
|
|
72
|
+
await Cookies.set('access_token', response.data.access_token, {
|
|
73
73
|
maxAge: 2147483647,
|
|
74
74
|
path: '/',
|
|
75
75
|
domain: domainHost,
|
|
76
76
|
secure: true
|
|
77
77
|
});
|
|
78
78
|
|
|
79
|
-
Cookies.set('expires_in', response.data.expires_in, {
|
|
79
|
+
await Cookies.set('expires_in', response.data.expires_in, {
|
|
80
80
|
maxAge: 2147483647,
|
|
81
81
|
path: '/',
|
|
82
82
|
domain: domainHost,
|
|
83
83
|
secure: true
|
|
84
84
|
});
|
|
85
85
|
|
|
86
|
-
Cookies.set('refresh_token', response.data.refresh_token, {
|
|
86
|
+
await Cookies.set('refresh_token', response.data.refresh_token, {
|
|
87
87
|
maxAge: 2147483647,
|
|
88
88
|
path: '/',
|
|
89
89
|
domain: domainHost,
|
|
@@ -8,7 +8,7 @@ const setupDefaultOptions = async (ctx = null) => {
|
|
|
8
8
|
let defaultOptions = {};
|
|
9
9
|
if (ctx == null)
|
|
10
10
|
{
|
|
11
|
-
let accessToken = Cookies.get('access_token') || '';
|
|
11
|
+
let accessToken = await Cookies.get('access_token') || '';
|
|
12
12
|
|
|
13
13
|
if (accessToken !== null && accessToken !== undefined && accessToken != "") {
|
|
14
14
|
defaultOptions = {
|
|
@@ -37,8 +37,8 @@ const setupDefaultOptions = async (ctx = null) => {
|
|
|
37
37
|
|
|
38
38
|
const RefreshToken = async (originalRequest, instance) => {
|
|
39
39
|
|
|
40
|
-
let accessToken = Cookies.get('access_token') || '';
|
|
41
|
-
let refreshToken = Cookies.get('refresh_token') || '';
|
|
40
|
+
let accessToken = await Cookies.get('access_token') || '';
|
|
41
|
+
let refreshToken = await Cookies.get('refresh_token') || '';
|
|
42
42
|
|
|
43
43
|
let response = await instance.post(process.env.authorityUri + "/connect/token",
|
|
44
44
|
querystring.stringify({
|
|
@@ -62,21 +62,21 @@ const RefreshToken = async (originalRequest, instance) => {
|
|
|
62
62
|
|
|
63
63
|
|
|
64
64
|
|
|
65
|
-
Cookies.set('access_token', response.data.access_token, {
|
|
65
|
+
await Cookies.set('access_token', response.data.access_token, {
|
|
66
66
|
maxAge: 2147483647,
|
|
67
67
|
path: '/',
|
|
68
68
|
domain: domainHost,
|
|
69
69
|
secure: true
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
-
Cookies.set('expires_in', response.data.expires_in, {
|
|
72
|
+
await Cookies.set('expires_in', response.data.expires_in, {
|
|
73
73
|
maxAge: 2147483647,
|
|
74
74
|
path: '/',
|
|
75
75
|
domain: domainHost,
|
|
76
76
|
secure: true
|
|
77
77
|
});
|
|
78
78
|
|
|
79
|
-
Cookies.set('refresh_token', response.data.refresh_token, {
|
|
79
|
+
await Cookies.set('refresh_token', response.data.refresh_token, {
|
|
80
80
|
maxAge: 2147483647,
|
|
81
81
|
path: '/',
|
|
82
82
|
domain: domainHost,
|
|
@@ -154,9 +154,9 @@ export const apiService = (ctx = null) => {
|
|
|
154
154
|
let domainHost = window.location.hostname.split('.').slice(-2).join('.');
|
|
155
155
|
|
|
156
156
|
|
|
157
|
-
Cookies.remove('access_token', { path: '/', domain: domainHost });
|
|
158
|
-
Cookies.remove('refresh_token', { path: '/', domain: domainHost });
|
|
159
|
-
Cookies.remove('expires_in', { path: '/', domain: domainHost });
|
|
157
|
+
await Cookies.remove('access_token', { path: '/', domain: domainHost });
|
|
158
|
+
await Cookies.remove('refresh_token', { path: '/', domain: domainHost });
|
|
159
|
+
await Cookies.remove('expires_in', { path: '/', domain: domainHost });
|
|
160
160
|
|
|
161
161
|
// destroyCookie(null, "access_token", {
|
|
162
162
|
// maxAge: 2147483647,
|
|
@@ -117,9 +117,9 @@ export const authService = () => {
|
|
|
117
117
|
let AuthUri = process.env.authorityUri;
|
|
118
118
|
|
|
119
119
|
|
|
120
|
-
Cookies.remove('access_token', { path: '/', domain: domainHost });
|
|
121
|
-
Cookies.remove('refresh_token', { path: '/', domain: domainHost });
|
|
122
|
-
Cookies.remove('expires_in', { path: '/', domain: domainHost });
|
|
120
|
+
await Cookies.remove('access_token', { path: '/', domain: domainHost });
|
|
121
|
+
await Cookies.remove('refresh_token', { path: '/', domain: domainHost });
|
|
122
|
+
await Cookies.remove('expires_in', { path: '/', domain: domainHost });
|
|
123
123
|
|
|
124
124
|
|
|
125
125
|
// destroyCookie({}, "access_token", {
|
|
@@ -28,21 +28,21 @@ export const signInValidator = async (queryCode) => {
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
Cookies.set('access_token', response.data.access_token, {
|
|
31
|
+
await Cookies.set('access_token', response.data.access_token, {
|
|
32
32
|
maxAge: 2147483647,
|
|
33
33
|
path: '/',
|
|
34
34
|
domain: domainHost,
|
|
35
35
|
secure: true
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
-
Cookies.set('expires_in', response.data.expires_in, {
|
|
38
|
+
await Cookies.set('expires_in', response.data.expires_in, {
|
|
39
39
|
maxAge: 2147483647,
|
|
40
40
|
path: '/',
|
|
41
41
|
domain: domainHost,
|
|
42
42
|
secure: true
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
Cookies.set('refresh_token', response.data.refresh_token, {
|
|
45
|
+
await Cookies.set('refresh_token', response.data.refresh_token, {
|
|
46
46
|
maxAge: 2147483647,
|
|
47
47
|
path: '/',
|
|
48
48
|
domain: domainHost,
|