authscape 1.0.654 → 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 +171 -79
- package/package.json +4 -5
- package/src/components/AuthScapeApp.js +30 -9
- package/src/components/googleMaps.js +0 -7
- package/src/services/apiService.js +62 -30
- package/src/services/authService.js +25 -18
- package/src/services/signInValidator.js +37 -13
package/index.js
CHANGED
|
@@ -12,7 +12,7 @@ var _head = _interopRequireDefault(require("next/head"));
|
|
|
12
12
|
var _navigation = require("next/navigation");
|
|
13
13
|
var _axios = _interopRequireDefault(require("axios"));
|
|
14
14
|
var _queryString = _interopRequireDefault(require("query-string"));
|
|
15
|
-
var
|
|
15
|
+
var _jsCookie = _interopRequireDefault(require("js-cookie"));
|
|
16
16
|
var _router = _interopRequireDefault(require("next/router"));
|
|
17
17
|
var _ga4React = _interopRequireDefault(require("ga-4-react"));
|
|
18
18
|
var _zustand = require("zustand");
|
|
@@ -109,7 +109,7 @@ function AuthScapeApp(_ref) {
|
|
|
109
109
|
domainHost = window.location.hostname.split('.').slice(-2).join('.');
|
|
110
110
|
window.localStorage.removeItem("verifier");
|
|
111
111
|
_context.next = 17;
|
|
112
|
-
return
|
|
112
|
+
return _jsCookie["default"].set('access_token', response.data.access_token, {
|
|
113
113
|
maxAge: 2147483647,
|
|
114
114
|
path: '/',
|
|
115
115
|
domain: domainHost,
|
|
@@ -117,7 +117,7 @@ function AuthScapeApp(_ref) {
|
|
|
117
117
|
});
|
|
118
118
|
case 17:
|
|
119
119
|
_context.next = 19;
|
|
120
|
-
return
|
|
120
|
+
return _jsCookie["default"].set('expires_in', response.data.expires_in, {
|
|
121
121
|
maxAge: 2147483647,
|
|
122
122
|
path: '/',
|
|
123
123
|
domain: domainHost,
|
|
@@ -125,13 +125,34 @@ function AuthScapeApp(_ref) {
|
|
|
125
125
|
});
|
|
126
126
|
case 19:
|
|
127
127
|
_context.next = 21;
|
|
128
|
-
return
|
|
128
|
+
return _jsCookie["default"].set('refresh_token', response.data.refresh_token, {
|
|
129
129
|
maxAge: 2147483647,
|
|
130
130
|
path: '/',
|
|
131
131
|
domain: domainHost,
|
|
132
132
|
secure: true
|
|
133
133
|
});
|
|
134
134
|
case 21:
|
|
135
|
+
// await setCookie(null, "access_token", response.data.access_token,
|
|
136
|
+
// {
|
|
137
|
+
// maxAge: 2147483647,
|
|
138
|
+
// path: '/',
|
|
139
|
+
// domain: domainHost,
|
|
140
|
+
// secure: true
|
|
141
|
+
// });
|
|
142
|
+
// await setCookie(null, "expires_in", response.data.expires_in,
|
|
143
|
+
// {
|
|
144
|
+
// maxAge: 2147483647,
|
|
145
|
+
// path: '/',
|
|
146
|
+
// domain: domainHost,
|
|
147
|
+
// secure: true
|
|
148
|
+
// });
|
|
149
|
+
// await setCookie(null, "refresh_token", response.data.refresh_token,
|
|
150
|
+
// {
|
|
151
|
+
// maxAge: 2147483647,
|
|
152
|
+
// path: '/',
|
|
153
|
+
// domain: domainHost,
|
|
154
|
+
// secure: true
|
|
155
|
+
// });
|
|
135
156
|
redirectUri = localStorage.getItem("redirectUri");
|
|
136
157
|
localStorage.clear();
|
|
137
158
|
if (redirectUri != null) {
|
|
@@ -2308,13 +2329,6 @@ var GoogleMapsHeatmap = function GoogleMapsHeatmap(_ref2) {
|
|
|
2308
2329
|
data: element
|
|
2309
2330
|
});
|
|
2310
2331
|
});
|
|
2311
|
-
|
|
2312
|
-
// const data = [
|
|
2313
|
-
// { location: new google.maps.LatLng(35.6895, 139.6917), weight: 100 }, // Tokyo
|
|
2314
|
-
// { location: new google.maps.LatLng(34.0522, -118.2437), weight: 200 }, // Los Angeles
|
|
2315
|
-
// { location: new google.maps.LatLng(51.5074, -0.1278), weight: 500 }, // London
|
|
2316
|
-
// // Add more data points as needed
|
|
2317
|
-
// ];
|
|
2318
2332
|
setHeatmapData(mappingData);
|
|
2319
2333
|
}
|
|
2320
2334
|
}, []);
|
|
@@ -8364,7 +8378,7 @@ exports.apiService = void 0;
|
|
|
8364
8378
|
var _axios = _interopRequireDefault(require("axios"));
|
|
8365
8379
|
var _queryString = _interopRequireDefault(require("query-string"));
|
|
8366
8380
|
var _jsFileDownload = _interopRequireDefault(require("js-file-download"));
|
|
8367
|
-
var
|
|
8381
|
+
var _jsCookie = _interopRequireDefault(require("js-cookie"));
|
|
8368
8382
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
8369
8383
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
8370
8384
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -8385,26 +8399,41 @@ var setupDefaultOptions = /*#__PURE__*/function () {
|
|
|
8385
8399
|
case 0:
|
|
8386
8400
|
ctx = _args.length > 0 && _args[0] !== undefined ? _args[0] : null;
|
|
8387
8401
|
defaultOptions = {};
|
|
8388
|
-
if (ctx == null) {
|
|
8389
|
-
|
|
8390
|
-
|
|
8391
|
-
|
|
8392
|
-
|
|
8393
|
-
|
|
8394
|
-
|
|
8395
|
-
|
|
8396
|
-
|
|
8397
|
-
|
|
8398
|
-
|
|
8399
|
-
|
|
8400
|
-
|
|
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
|
+
};
|
|
8401
8423
|
} else {
|
|
8402
8424
|
defaultOptions = {
|
|
8403
8425
|
headers: {}
|
|
8404
8426
|
};
|
|
8405
8427
|
}
|
|
8428
|
+
_context.next = 13;
|
|
8429
|
+
break;
|
|
8430
|
+
case 12:
|
|
8431
|
+
defaultOptions = {
|
|
8432
|
+
headers: {}
|
|
8433
|
+
};
|
|
8434
|
+
case 13:
|
|
8406
8435
|
return _context.abrupt("return", defaultOptions);
|
|
8407
|
-
case
|
|
8436
|
+
case 14:
|
|
8408
8437
|
case "end":
|
|
8409
8438
|
return _context.stop();
|
|
8410
8439
|
}
|
|
@@ -8420,9 +8449,29 @@ var RefreshToken = /*#__PURE__*/function () {
|
|
|
8420
8449
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
8421
8450
|
while (1) switch (_context2.prev = _context2.next) {
|
|
8422
8451
|
case 0:
|
|
8423
|
-
|
|
8424
|
-
|
|
8425
|
-
|
|
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;
|
|
8426
8475
|
return instance.post(process.env.authorityUri + "/connect/token", _queryString["default"].stringify({
|
|
8427
8476
|
grant_type: 'refresh_token',
|
|
8428
8477
|
client_id: process.env.client_id,
|
|
@@ -8434,38 +8483,38 @@ var RefreshToken = /*#__PURE__*/function () {
|
|
|
8434
8483
|
"Authorization": "Bearer " + accessToken
|
|
8435
8484
|
}
|
|
8436
8485
|
});
|
|
8437
|
-
case
|
|
8486
|
+
case 14:
|
|
8438
8487
|
response = _context2.sent;
|
|
8439
8488
|
if (!(response != null && response.status == 200)) {
|
|
8440
|
-
_context2.next =
|
|
8489
|
+
_context2.next = 24;
|
|
8441
8490
|
break;
|
|
8442
8491
|
}
|
|
8443
8492
|
domainHost = window.location.hostname.split('.').slice(-2).join('.');
|
|
8444
8493
|
originalRequest.headers['Authorization'] = 'Bearer ' + response.data.access_token;
|
|
8445
|
-
_context2.next =
|
|
8446
|
-
return
|
|
8494
|
+
_context2.next = 20;
|
|
8495
|
+
return _jsCookie["default"].set('access_token', response.data.access_token, {
|
|
8447
8496
|
maxAge: 2147483647,
|
|
8448
8497
|
path: '/',
|
|
8449
8498
|
domain: domainHost,
|
|
8450
8499
|
secure: true
|
|
8451
8500
|
});
|
|
8452
|
-
case
|
|
8453
|
-
_context2.next =
|
|
8454
|
-
return
|
|
8501
|
+
case 20:
|
|
8502
|
+
_context2.next = 22;
|
|
8503
|
+
return _jsCookie["default"].set('expires_in', response.data.expires_in, {
|
|
8455
8504
|
maxAge: 2147483647,
|
|
8456
8505
|
path: '/',
|
|
8457
8506
|
domain: domainHost,
|
|
8458
8507
|
secure: true
|
|
8459
8508
|
});
|
|
8460
|
-
case
|
|
8461
|
-
_context2.next =
|
|
8462
|
-
return
|
|
8509
|
+
case 22:
|
|
8510
|
+
_context2.next = 24;
|
|
8511
|
+
return _jsCookie["default"].set('refresh_token', response.data.refresh_token, {
|
|
8463
8512
|
maxAge: 2147483647,
|
|
8464
8513
|
path: '/',
|
|
8465
8514
|
domain: domainHost,
|
|
8466
8515
|
secure: true
|
|
8467
8516
|
});
|
|
8468
|
-
case
|
|
8517
|
+
case 24:
|
|
8469
8518
|
case "end":
|
|
8470
8519
|
return _context2.stop();
|
|
8471
8520
|
}
|
|
@@ -8498,7 +8547,7 @@ var apiService = function apiService() {
|
|
|
8498
8547
|
case 0:
|
|
8499
8548
|
originalConfig = error.config;
|
|
8500
8549
|
if (!error.response) {
|
|
8501
|
-
_context3.next =
|
|
8550
|
+
_context3.next = 17;
|
|
8502
8551
|
break;
|
|
8503
8552
|
}
|
|
8504
8553
|
if (!(error.response.status === 401 && !originalConfig._retry)) {
|
|
@@ -8514,35 +8563,36 @@ var apiService = function apiService() {
|
|
|
8514
8563
|
return _context3.abrupt("return", instance.request(originalConfig));
|
|
8515
8564
|
case 7:
|
|
8516
8565
|
if (!(error.response.status === 400)) {
|
|
8517
|
-
_context3.next =
|
|
8566
|
+
_context3.next = 17;
|
|
8518
8567
|
break;
|
|
8519
8568
|
}
|
|
8520
|
-
|
|
8521
|
-
|
|
8522
|
-
|
|
8523
|
-
|
|
8524
|
-
|
|
8525
|
-
|
|
8526
|
-
|
|
8527
|
-
|
|
8528
|
-
|
|
8529
|
-
|
|
8530
|
-
|
|
8531
|
-
|
|
8532
|
-
|
|
8533
|
-
|
|
8534
|
-
|
|
8535
|
-
|
|
8536
|
-
|
|
8537
|
-
|
|
8538
|
-
|
|
8539
|
-
|
|
8540
|
-
|
|
8541
|
-
|
|
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:
|
|
8542
8592
|
return _context3.abrupt("return", Promise.reject(error));
|
|
8543
|
-
case
|
|
8593
|
+
case 17:
|
|
8544
8594
|
return _context3.abrupt("return", Promise.reject(error));
|
|
8545
|
-
case
|
|
8595
|
+
case 18:
|
|
8546
8596
|
case "end":
|
|
8547
8597
|
return _context3.stop();
|
|
8548
8598
|
}
|
|
@@ -8692,7 +8742,7 @@ var apiService = function apiService() {
|
|
|
8692
8742
|
while (1) switch (_context8.prev = _context8.next) {
|
|
8693
8743
|
case 0:
|
|
8694
8744
|
_context8.prev = 0;
|
|
8695
|
-
accessToken =
|
|
8745
|
+
accessToken = _jsCookie["default"].get('access_token') || null;
|
|
8696
8746
|
if (!accessToken) {
|
|
8697
8747
|
_context8.next = 11;
|
|
8698
8748
|
break;
|
|
@@ -8892,7 +8942,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8892
8942
|
});
|
|
8893
8943
|
exports.authService = void 0;
|
|
8894
8944
|
var _react = _interopRequireDefault(require("react"));
|
|
8895
|
-
var
|
|
8945
|
+
var _jsCookie = _interopRequireDefault(require("js-cookie"));
|
|
8896
8946
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
8897
8947
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
8898
8948
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
@@ -9085,21 +9135,42 @@ var authService = function authService() {
|
|
|
9085
9135
|
redirectUri = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : null;
|
|
9086
9136
|
domainHost = window.location.hostname.split('.').slice(-2).join('.');
|
|
9087
9137
|
AuthUri = process.env.authorityUri;
|
|
9088
|
-
|
|
9089
|
-
|
|
9138
|
+
_context6.next = 5;
|
|
9139
|
+
return _jsCookie["default"].remove('access_token', {
|
|
9090
9140
|
path: '/',
|
|
9091
9141
|
domain: domainHost
|
|
9092
9142
|
});
|
|
9093
|
-
|
|
9094
|
-
|
|
9143
|
+
case 5:
|
|
9144
|
+
_context6.next = 7;
|
|
9145
|
+
return _jsCookie["default"].remove('refresh_token', {
|
|
9095
9146
|
path: '/',
|
|
9096
9147
|
domain: domainHost
|
|
9097
9148
|
});
|
|
9098
|
-
|
|
9099
|
-
|
|
9149
|
+
case 7:
|
|
9150
|
+
_context6.next = 9;
|
|
9151
|
+
return _jsCookie["default"].remove('expires_in', {
|
|
9100
9152
|
path: '/',
|
|
9101
9153
|
domain: domainHost
|
|
9102
9154
|
});
|
|
9155
|
+
case 9:
|
|
9156
|
+
// destroyCookie({}, "access_token", {
|
|
9157
|
+
// maxAge: 2147483647,
|
|
9158
|
+
// path: '/',
|
|
9159
|
+
// domain: domainHost
|
|
9160
|
+
// });
|
|
9161
|
+
|
|
9162
|
+
// destroyCookie({}, "refresh_token", {
|
|
9163
|
+
// maxAge: 2147483647,
|
|
9164
|
+
// path: '/',
|
|
9165
|
+
// domain: domainHost
|
|
9166
|
+
// });
|
|
9167
|
+
|
|
9168
|
+
// destroyCookie({}, "expires_in", {
|
|
9169
|
+
// maxAge: 2147483647,
|
|
9170
|
+
// path: '/',
|
|
9171
|
+
// domain: domainHost
|
|
9172
|
+
// });
|
|
9173
|
+
|
|
9103
9174
|
setTimeout(function () {
|
|
9104
9175
|
if (redirectUri == null) {
|
|
9105
9176
|
window.location.href = AuthUri + "/connect/logout?redirect=" + window.location.href;
|
|
@@ -9107,7 +9178,7 @@ var authService = function authService() {
|
|
|
9107
9178
|
window.location.href = AuthUri + "/connect/logout?redirect=" + redirectUri;
|
|
9108
9179
|
}
|
|
9109
9180
|
}, 500);
|
|
9110
|
-
case
|
|
9181
|
+
case 10:
|
|
9111
9182
|
case "end":
|
|
9112
9183
|
return _context6.stop();
|
|
9113
9184
|
}
|
|
@@ -9203,7 +9274,7 @@ exports.signInValidator = void 0;
|
|
|
9203
9274
|
var _react = _interopRequireWildcard(require("react"));
|
|
9204
9275
|
var _axios = _interopRequireDefault(require("axios"));
|
|
9205
9276
|
var _queryString = _interopRequireDefault(require("query-string"));
|
|
9206
|
-
var
|
|
9277
|
+
var _jsCookie = _interopRequireDefault(require("js-cookie"));
|
|
9207
9278
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
9208
9279
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
9209
9280
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -9241,7 +9312,7 @@ var signInValidator = /*#__PURE__*/function () {
|
|
|
9241
9312
|
domainHost = window.location.hostname.split('.').slice(-2).join('.');
|
|
9242
9313
|
window.localStorage.removeItem("verifier");
|
|
9243
9314
|
_context.next = 11;
|
|
9244
|
-
return
|
|
9315
|
+
return _jsCookie["default"].set('access_token', response.data.access_token, {
|
|
9245
9316
|
maxAge: 2147483647,
|
|
9246
9317
|
path: '/',
|
|
9247
9318
|
domain: domainHost,
|
|
@@ -9249,7 +9320,7 @@ var signInValidator = /*#__PURE__*/function () {
|
|
|
9249
9320
|
});
|
|
9250
9321
|
case 11:
|
|
9251
9322
|
_context.next = 13;
|
|
9252
|
-
return
|
|
9323
|
+
return _jsCookie["default"].set('expires_in', response.data.expires_in, {
|
|
9253
9324
|
maxAge: 2147483647,
|
|
9254
9325
|
path: '/',
|
|
9255
9326
|
domain: domainHost,
|
|
@@ -9257,13 +9328,34 @@ var signInValidator = /*#__PURE__*/function () {
|
|
|
9257
9328
|
});
|
|
9258
9329
|
case 13:
|
|
9259
9330
|
_context.next = 15;
|
|
9260
|
-
return
|
|
9331
|
+
return _jsCookie["default"].set('refresh_token', response.data.refresh_token, {
|
|
9261
9332
|
maxAge: 2147483647,
|
|
9262
9333
|
path: '/',
|
|
9263
9334
|
domain: domainHost,
|
|
9264
9335
|
secure: true
|
|
9265
9336
|
});
|
|
9266
9337
|
case 15:
|
|
9338
|
+
// await setCookie(null, "access_token", response.data.access_token,
|
|
9339
|
+
// {
|
|
9340
|
+
// maxAge: 2147483647,
|
|
9341
|
+
// path: '/',
|
|
9342
|
+
// domain: domainHost,
|
|
9343
|
+
// secure: true
|
|
9344
|
+
// });
|
|
9345
|
+
// await setCookie(null, "expires_in", response.data.expires_in,
|
|
9346
|
+
// {
|
|
9347
|
+
// maxAge: 2147483647,
|
|
9348
|
+
// path: '/',
|
|
9349
|
+
// domain: domainHost,
|
|
9350
|
+
// secure: true
|
|
9351
|
+
// });
|
|
9352
|
+
// await setCookie(null, "refresh_token", response.data.refresh_token,
|
|
9353
|
+
// {
|
|
9354
|
+
// maxAge: 2147483647,
|
|
9355
|
+
// path: '/',
|
|
9356
|
+
// domain: domainHost,
|
|
9357
|
+
// secure: true
|
|
9358
|
+
// });
|
|
9267
9359
|
redirectUri = localStorage.getItem("redirectUri");
|
|
9268
9360
|
localStorage.clear();
|
|
9269
9361
|
if (redirectUri != null) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "authscape",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.658",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"peerDependencies": {
|
|
13
13
|
"js-file-download": "^0.4.12",
|
|
14
|
-
"nookies": "^2.5.2",
|
|
15
14
|
"react-data-table-component": "^7.5.2",
|
|
16
15
|
"react-dom": "^18.2.0"
|
|
17
16
|
},
|
|
@@ -23,17 +22,17 @@
|
|
|
23
22
|
"react-dom": "^18.2.0"
|
|
24
23
|
},
|
|
25
24
|
"dependencies": {
|
|
26
|
-
"@emotion/react": "^11.11.3",
|
|
27
|
-
"@emotion/styled": "^11.11.0",
|
|
28
25
|
"@microsoft/signalr": "^8.0.0",
|
|
26
|
+
"audit": "^0.0.6",
|
|
29
27
|
"axios": "^1.6.1",
|
|
30
28
|
"eslint-config-next": "^14.1.0",
|
|
29
|
+
"fix": "^0.0.3",
|
|
31
30
|
"ga-4-react": "^0.1.281",
|
|
32
31
|
"html2canvas": "^1.4.1",
|
|
32
|
+
"js-cookie": "^3.0.5",
|
|
33
33
|
"js-file-download": "^0.4.12",
|
|
34
34
|
"jspdf": "^2.5.1",
|
|
35
35
|
"next": "^14.1.0",
|
|
36
|
-
"nookies": "^2.5.2",
|
|
37
36
|
"query-string": "^7.1.1",
|
|
38
37
|
"react": "^18.2.0",
|
|
39
38
|
"react-color": "^2.19.3",
|
|
@@ -5,7 +5,7 @@ import Head from "next/head";
|
|
|
5
5
|
import { useSearchParams, usePathname } from 'next/navigation';
|
|
6
6
|
import axios from 'axios';
|
|
7
7
|
import querystring from "query-string";
|
|
8
|
-
import
|
|
8
|
+
import Cookies from 'js-cookie';
|
|
9
9
|
import Router from 'next/router';
|
|
10
10
|
import GA4React from 'ga-4-react';
|
|
11
11
|
import { create } from 'zustand'
|
|
@@ -69,29 +69,50 @@ 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
|
-
await
|
|
73
|
-
{
|
|
72
|
+
await Cookies.set('access_token', response.data.access_token, {
|
|
74
73
|
maxAge: 2147483647,
|
|
75
74
|
path: '/',
|
|
76
75
|
domain: domainHost,
|
|
77
76
|
secure: true
|
|
78
77
|
});
|
|
79
|
-
|
|
80
|
-
await
|
|
81
|
-
{
|
|
78
|
+
|
|
79
|
+
await Cookies.set('expires_in', response.data.expires_in, {
|
|
82
80
|
maxAge: 2147483647,
|
|
83
81
|
path: '/',
|
|
84
82
|
domain: domainHost,
|
|
85
83
|
secure: true
|
|
86
84
|
});
|
|
87
|
-
|
|
88
|
-
await
|
|
89
|
-
{
|
|
85
|
+
|
|
86
|
+
await Cookies.set('refresh_token', response.data.refresh_token, {
|
|
90
87
|
maxAge: 2147483647,
|
|
91
88
|
path: '/',
|
|
92
89
|
domain: domainHost,
|
|
93
90
|
secure: true
|
|
94
91
|
});
|
|
92
|
+
|
|
93
|
+
// await setCookie(null, "access_token", response.data.access_token,
|
|
94
|
+
// {
|
|
95
|
+
// maxAge: 2147483647,
|
|
96
|
+
// path: '/',
|
|
97
|
+
// domain: domainHost,
|
|
98
|
+
// secure: true
|
|
99
|
+
// });
|
|
100
|
+
|
|
101
|
+
// await setCookie(null, "expires_in", response.data.expires_in,
|
|
102
|
+
// {
|
|
103
|
+
// maxAge: 2147483647,
|
|
104
|
+
// path: '/',
|
|
105
|
+
// domain: domainHost,
|
|
106
|
+
// secure: true
|
|
107
|
+
// });
|
|
108
|
+
|
|
109
|
+
// await setCookie(null, "refresh_token", response.data.refresh_token,
|
|
110
|
+
// {
|
|
111
|
+
// maxAge: 2147483647,
|
|
112
|
+
// path: '/',
|
|
113
|
+
// domain: domainHost,
|
|
114
|
+
// secure: true
|
|
115
|
+
// });
|
|
95
116
|
|
|
96
117
|
|
|
97
118
|
let redirectUri = localStorage.getItem("redirectUri")
|
|
@@ -41,13 +41,6 @@ export const GoogleMapsHeatmap = ({apiKey, data = [], gradient = null, radius =
|
|
|
41
41
|
data.forEach(element => {
|
|
42
42
|
mappingData.push({ location: new google.maps.LatLng(element.lat, element.lng), weight: element.weight, data: element });
|
|
43
43
|
});
|
|
44
|
-
|
|
45
|
-
// const data = [
|
|
46
|
-
// { location: new google.maps.LatLng(35.6895, 139.6917), weight: 100 }, // Tokyo
|
|
47
|
-
// { location: new google.maps.LatLng(34.0522, -118.2437), weight: 200 }, // Los Angeles
|
|
48
|
-
// { location: new google.maps.LatLng(51.5074, -0.1278), weight: 500 }, // London
|
|
49
|
-
// // Add more data points as needed
|
|
50
|
-
// ];
|
|
51
44
|
setHeatmapData(mappingData);
|
|
52
45
|
|
|
53
46
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import axios from 'axios'
|
|
2
2
|
import querystring from 'query-string';
|
|
3
3
|
import fileDownload from 'js-file-download';
|
|
4
|
-
import
|
|
4
|
+
import Cookies from 'js-cookie';
|
|
5
5
|
|
|
6
6
|
const setupDefaultOptions = async (ctx = null) => {
|
|
7
7
|
|
|
8
8
|
let defaultOptions = {};
|
|
9
9
|
if (ctx == null)
|
|
10
10
|
{
|
|
11
|
-
let accessToken =
|
|
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 =
|
|
41
|
-
let refreshToken =
|
|
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({
|
|
@@ -58,29 +58,56 @@ const RefreshToken = async (originalRequest, instance) => {
|
|
|
58
58
|
let domainHost = window.location.hostname.split('.').slice(-2).join('.');
|
|
59
59
|
originalRequest.headers['Authorization'] = 'Bearer ' + response.data.access_token;
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
await Cookies.set('access_token', response.data.access_token, {
|
|
63
66
|
maxAge: 2147483647,
|
|
64
67
|
path: '/',
|
|
65
68
|
domain: domainHost,
|
|
66
69
|
secure: true
|
|
67
70
|
});
|
|
68
|
-
|
|
69
|
-
await
|
|
70
|
-
{
|
|
71
|
+
|
|
72
|
+
await Cookies.set('expires_in', response.data.expires_in, {
|
|
71
73
|
maxAge: 2147483647,
|
|
72
74
|
path: '/',
|
|
73
75
|
domain: domainHost,
|
|
74
76
|
secure: true
|
|
75
77
|
});
|
|
76
|
-
|
|
77
|
-
await
|
|
78
|
-
{
|
|
78
|
+
|
|
79
|
+
await Cookies.set('refresh_token', response.data.refresh_token, {
|
|
79
80
|
maxAge: 2147483647,
|
|
80
81
|
path: '/',
|
|
81
82
|
domain: domainHost,
|
|
82
83
|
secure: true
|
|
83
84
|
});
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
// await setCookie(null, "access_token", response.data.access_token,
|
|
89
|
+
// {
|
|
90
|
+
// maxAge: 2147483647,
|
|
91
|
+
// path: '/',
|
|
92
|
+
// domain: domainHost,
|
|
93
|
+
// secure: true
|
|
94
|
+
// });
|
|
95
|
+
|
|
96
|
+
// await setCookie(null, "expires_in", response.data.expires_in,
|
|
97
|
+
// {
|
|
98
|
+
// maxAge: 2147483647,
|
|
99
|
+
// path: '/',
|
|
100
|
+
// domain: domainHost,
|
|
101
|
+
// secure: true
|
|
102
|
+
// });
|
|
103
|
+
|
|
104
|
+
// await setCookie(null, "refresh_token", response.data.refresh_token,
|
|
105
|
+
// {
|
|
106
|
+
// maxAge: 2147483647,
|
|
107
|
+
// path: '/',
|
|
108
|
+
// domain: domainHost,
|
|
109
|
+
// secure: true
|
|
110
|
+
// });
|
|
84
111
|
}
|
|
85
112
|
}
|
|
86
113
|
|
|
@@ -126,23 +153,28 @@ export const apiService = (ctx = null) => {
|
|
|
126
153
|
{
|
|
127
154
|
let domainHost = window.location.hostname.split('.').slice(-2).join('.');
|
|
128
155
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
156
|
+
|
|
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
|
+
|
|
161
|
+
// destroyCookie(null, "access_token", {
|
|
162
|
+
// maxAge: 2147483647,
|
|
163
|
+
// path: '/',
|
|
164
|
+
// domain: domainHost
|
|
165
|
+
// });
|
|
166
|
+
|
|
167
|
+
// destroyCookie(null, "refresh_token", {
|
|
168
|
+
// maxAge: 2147483647,
|
|
169
|
+
// path: '/',
|
|
170
|
+
// domain: domainHost
|
|
171
|
+
// });
|
|
172
|
+
|
|
173
|
+
// destroyCookie(null, "expires_in", {
|
|
174
|
+
// maxAge: 2147483647,
|
|
175
|
+
// path: '/',
|
|
176
|
+
// domain: domainHost
|
|
177
|
+
// });
|
|
146
178
|
}
|
|
147
179
|
|
|
148
180
|
return Promise.reject(error);
|
|
@@ -207,7 +239,7 @@ export const apiService = (ctx = null) => {
|
|
|
207
239
|
|
|
208
240
|
try
|
|
209
241
|
{
|
|
210
|
-
let accessToken =
|
|
242
|
+
let accessToken = Cookies.get('access_token') || null;
|
|
211
243
|
|
|
212
244
|
if (accessToken)
|
|
213
245
|
{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import Cookies from 'js-cookie';
|
|
3
3
|
|
|
4
4
|
export const authService = () => {
|
|
5
5
|
|
|
@@ -115,23 +115,30 @@ export const authService = () => {
|
|
|
115
115
|
|
|
116
116
|
let domainHost = window.location.hostname.split('.').slice(-2).join('.');
|
|
117
117
|
let AuthUri = process.env.authorityUri;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
118
|
+
|
|
119
|
+
|
|
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
|
+
|
|
124
|
+
|
|
125
|
+
// destroyCookie({}, "access_token", {
|
|
126
|
+
// maxAge: 2147483647,
|
|
127
|
+
// path: '/',
|
|
128
|
+
// domain: domainHost
|
|
129
|
+
// });
|
|
130
|
+
|
|
131
|
+
// destroyCookie({}, "refresh_token", {
|
|
132
|
+
// maxAge: 2147483647,
|
|
133
|
+
// path: '/',
|
|
134
|
+
// domain: domainHost
|
|
135
|
+
// });
|
|
136
|
+
|
|
137
|
+
// destroyCookie({}, "expires_in", {
|
|
138
|
+
// maxAge: 2147483647,
|
|
139
|
+
// path: '/',
|
|
140
|
+
// domain: domainHost
|
|
141
|
+
// });
|
|
135
142
|
|
|
136
143
|
setTimeout(() => {
|
|
137
144
|
if (redirectUri == null)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import axios from 'axios';
|
|
3
3
|
import querystring from "query-string";
|
|
4
|
-
import
|
|
4
|
+
import Cookies from 'js-cookie';
|
|
5
5
|
|
|
6
6
|
export const signInValidator = async (queryCode) => {
|
|
7
7
|
|
|
@@ -26,31 +26,55 @@ export const signInValidator = async (queryCode) => {
|
|
|
26
26
|
let domainHost = window.location.hostname.split('.').slice(-2).join('.');
|
|
27
27
|
window.localStorage.removeItem("verifier");
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
await Cookies.set('access_token', response.data.access_token, {
|
|
31
32
|
maxAge: 2147483647,
|
|
32
33
|
path: '/',
|
|
33
34
|
domain: domainHost,
|
|
34
35
|
secure: true
|
|
35
36
|
});
|
|
36
|
-
|
|
37
|
-
await
|
|
38
|
-
{
|
|
37
|
+
|
|
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
|
-
|
|
45
|
-
await
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
secure: true
|
|
44
|
+
|
|
45
|
+
await Cookies.set('refresh_token', response.data.refresh_token, {
|
|
46
|
+
maxAge: 2147483647,
|
|
47
|
+
path: '/',
|
|
48
|
+
domain: domainHost,
|
|
49
|
+
secure: true
|
|
51
50
|
});
|
|
52
51
|
|
|
53
52
|
|
|
53
|
+
// await setCookie(null, "access_token", response.data.access_token,
|
|
54
|
+
// {
|
|
55
|
+
// maxAge: 2147483647,
|
|
56
|
+
// path: '/',
|
|
57
|
+
// domain: domainHost,
|
|
58
|
+
// secure: true
|
|
59
|
+
// });
|
|
60
|
+
|
|
61
|
+
// await setCookie(null, "expires_in", response.data.expires_in,
|
|
62
|
+
// {
|
|
63
|
+
// maxAge: 2147483647,
|
|
64
|
+
// path: '/',
|
|
65
|
+
// domain: domainHost,
|
|
66
|
+
// secure: true
|
|
67
|
+
// });
|
|
68
|
+
|
|
69
|
+
// await setCookie(null, "refresh_token", response.data.refresh_token,
|
|
70
|
+
// {
|
|
71
|
+
// maxAge: 2147483647,
|
|
72
|
+
// path: '/',
|
|
73
|
+
// domain: domainHost,
|
|
74
|
+
// secure: true
|
|
75
|
+
// });
|
|
76
|
+
|
|
77
|
+
|
|
54
78
|
let redirectUri = localStorage.getItem("redirectUri")
|
|
55
79
|
localStorage.clear();
|
|
56
80
|
if (redirectUri != null)
|