authscape 1.0.652 → 1.0.656
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 +161 -83
- package/package.json +4 -5
- package/src/components/AuthScapeApp.js +30 -9
- package/src/components/googleMaps.js +1 -8
- 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");
|
|
@@ -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 = 25;
|
|
89
89
|
break;
|
|
90
90
|
}
|
|
91
91
|
headers = {
|
|
@@ -108,30 +108,48 @@ 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
|
-
|
|
112
|
-
return (0, _nookies.setCookie)(null, "access_token", response.data.access_token, {
|
|
111
|
+
_jsCookie["default"].set('access_token', response.data.access_token, {
|
|
113
112
|
maxAge: 2147483647,
|
|
114
113
|
path: '/',
|
|
115
114
|
domain: domainHost,
|
|
116
115
|
secure: true
|
|
117
116
|
});
|
|
118
|
-
|
|
119
|
-
_context.next = 19;
|
|
120
|
-
return (0, _nookies.setCookie)(null, "expires_in", response.data.expires_in, {
|
|
117
|
+
_jsCookie["default"].set('expires_in', response.data.expires_in, {
|
|
121
118
|
maxAge: 2147483647,
|
|
122
119
|
path: '/',
|
|
123
120
|
domain: domainHost,
|
|
124
121
|
secure: true
|
|
125
122
|
});
|
|
126
|
-
|
|
127
|
-
_context.next = 21;
|
|
128
|
-
return (0, _nookies.setCookie)(null, "refresh_token", response.data.refresh_token, {
|
|
123
|
+
_jsCookie["default"].set('refresh_token', response.data.refresh_token, {
|
|
129
124
|
maxAge: 2147483647,
|
|
130
125
|
path: '/',
|
|
131
126
|
domain: domainHost,
|
|
132
127
|
secure: true
|
|
133
128
|
});
|
|
134
|
-
|
|
129
|
+
|
|
130
|
+
// await setCookie(null, "access_token", response.data.access_token,
|
|
131
|
+
// {
|
|
132
|
+
// maxAge: 2147483647,
|
|
133
|
+
// path: '/',
|
|
134
|
+
// domain: domainHost,
|
|
135
|
+
// secure: true
|
|
136
|
+
// });
|
|
137
|
+
|
|
138
|
+
// await setCookie(null, "expires_in", response.data.expires_in,
|
|
139
|
+
// {
|
|
140
|
+
// maxAge: 2147483647,
|
|
141
|
+
// path: '/',
|
|
142
|
+
// domain: domainHost,
|
|
143
|
+
// secure: true
|
|
144
|
+
// });
|
|
145
|
+
|
|
146
|
+
// await setCookie(null, "refresh_token", response.data.refresh_token,
|
|
147
|
+
// {
|
|
148
|
+
// maxAge: 2147483647,
|
|
149
|
+
// path: '/',
|
|
150
|
+
// domain: domainHost,
|
|
151
|
+
// secure: true
|
|
152
|
+
// });
|
|
135
153
|
redirectUri = localStorage.getItem("redirectUri");
|
|
136
154
|
localStorage.clear();
|
|
137
155
|
if (redirectUri != null) {
|
|
@@ -139,16 +157,16 @@ function AuthScapeApp(_ref) {
|
|
|
139
157
|
} else {
|
|
140
158
|
window.location.href = "/";
|
|
141
159
|
}
|
|
142
|
-
_context.next =
|
|
160
|
+
_context.next = 25;
|
|
143
161
|
break;
|
|
144
|
-
case
|
|
145
|
-
_context.prev =
|
|
162
|
+
case 23:
|
|
163
|
+
_context.prev = 23;
|
|
146
164
|
_context.t0 = _context["catch"](9);
|
|
147
|
-
case
|
|
165
|
+
case 25:
|
|
148
166
|
case "end":
|
|
149
167
|
return _context.stop();
|
|
150
168
|
}
|
|
151
|
-
}, _callee, null, [[9,
|
|
169
|
+
}, _callee, null, [[9, 23]]);
|
|
152
170
|
}));
|
|
153
171
|
return function signInValidator(_x2) {
|
|
154
172
|
return _ref2.apply(this, arguments);
|
|
@@ -2283,7 +2301,8 @@ var GoogleMapsHeatmap = function GoogleMapsHeatmap(_ref2) {
|
|
|
2283
2301
|
var apiKey = _ref2.apiKey,
|
|
2284
2302
|
_ref2$data = _ref2.data,
|
|
2285
2303
|
data = _ref2$data === void 0 ? [] : _ref2$data,
|
|
2286
|
-
gradient = _ref2.gradient,
|
|
2304
|
+
_ref2$gradient = _ref2.gradient,
|
|
2305
|
+
gradient = _ref2$gradient === void 0 ? null : _ref2$gradient,
|
|
2287
2306
|
_ref2$radius = _ref2.radius,
|
|
2288
2307
|
radius = _ref2$radius === void 0 ? 50 : _ref2$radius,
|
|
2289
2308
|
_ref2$opacity = _ref2.opacity,
|
|
@@ -2307,13 +2326,6 @@ var GoogleMapsHeatmap = function GoogleMapsHeatmap(_ref2) {
|
|
|
2307
2326
|
data: element
|
|
2308
2327
|
});
|
|
2309
2328
|
});
|
|
2310
|
-
|
|
2311
|
-
// const data = [
|
|
2312
|
-
// { location: new google.maps.LatLng(35.6895, 139.6917), weight: 100 }, // Tokyo
|
|
2313
|
-
// { location: new google.maps.LatLng(34.0522, -118.2437), weight: 200 }, // Los Angeles
|
|
2314
|
-
// { location: new google.maps.LatLng(51.5074, -0.1278), weight: 500 }, // London
|
|
2315
|
-
// // Add more data points as needed
|
|
2316
|
-
// ];
|
|
2317
2329
|
setHeatmapData(mappingData);
|
|
2318
2330
|
}
|
|
2319
2331
|
}, []);
|
|
@@ -8363,7 +8375,7 @@ exports.apiService = void 0;
|
|
|
8363
8375
|
var _axios = _interopRequireDefault(require("axios"));
|
|
8364
8376
|
var _queryString = _interopRequireDefault(require("query-string"));
|
|
8365
8377
|
var _jsFileDownload = _interopRequireDefault(require("js-file-download"));
|
|
8366
|
-
var
|
|
8378
|
+
var _jsCookie = _interopRequireDefault(require("js-cookie"));
|
|
8367
8379
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
8368
8380
|
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; }
|
|
8369
8381
|
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,7 +8397,7 @@ var setupDefaultOptions = /*#__PURE__*/function () {
|
|
|
8385
8397
|
ctx = _args.length > 0 && _args[0] !== undefined ? _args[0] : null;
|
|
8386
8398
|
defaultOptions = {};
|
|
8387
8399
|
if (ctx == null) {
|
|
8388
|
-
accessToken =
|
|
8400
|
+
accessToken = _jsCookie["default"].get('access_token') || '';
|
|
8389
8401
|
if (accessToken !== null && accessToken !== undefined && accessToken != "") {
|
|
8390
8402
|
defaultOptions = {
|
|
8391
8403
|
headers: {
|
|
@@ -8419,8 +8431,8 @@ var RefreshToken = /*#__PURE__*/function () {
|
|
|
8419
8431
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
8420
8432
|
while (1) switch (_context2.prev = _context2.next) {
|
|
8421
8433
|
case 0:
|
|
8422
|
-
accessToken =
|
|
8423
|
-
refreshToken =
|
|
8434
|
+
accessToken = _jsCookie["default"].get('access_token') || '';
|
|
8435
|
+
refreshToken = _jsCookie["default"].get('refresh_token') || '';
|
|
8424
8436
|
_context2.next = 4;
|
|
8425
8437
|
return instance.post(process.env.authorityUri + "/connect/token", _queryString["default"].stringify({
|
|
8426
8438
|
grant_type: 'refresh_token',
|
|
@@ -8435,36 +8447,53 @@ var RefreshToken = /*#__PURE__*/function () {
|
|
|
8435
8447
|
});
|
|
8436
8448
|
case 4:
|
|
8437
8449
|
response = _context2.sent;
|
|
8438
|
-
if (
|
|
8439
|
-
|
|
8440
|
-
|
|
8450
|
+
if (response != null && response.status == 200) {
|
|
8451
|
+
domainHost = window.location.hostname.split('.').slice(-2).join('.');
|
|
8452
|
+
originalRequest.headers['Authorization'] = 'Bearer ' + response.data.access_token;
|
|
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
|
+
// });
|
|
8441
8495
|
}
|
|
8442
|
-
|
|
8443
|
-
originalRequest.headers['Authorization'] = 'Bearer ' + response.data.access_token;
|
|
8444
|
-
_context2.next = 10;
|
|
8445
|
-
return (0, _nookies.setCookie)(null, "access_token", response.data.access_token, {
|
|
8446
|
-
maxAge: 2147483647,
|
|
8447
|
-
path: '/',
|
|
8448
|
-
domain: domainHost,
|
|
8449
|
-
secure: true
|
|
8450
|
-
});
|
|
8451
|
-
case 10:
|
|
8452
|
-
_context2.next = 12;
|
|
8453
|
-
return (0, _nookies.setCookie)(null, "expires_in", response.data.expires_in, {
|
|
8454
|
-
maxAge: 2147483647,
|
|
8455
|
-
path: '/',
|
|
8456
|
-
domain: domainHost,
|
|
8457
|
-
secure: true
|
|
8458
|
-
});
|
|
8459
|
-
case 12:
|
|
8460
|
-
_context2.next = 14;
|
|
8461
|
-
return (0, _nookies.setCookie)(null, "refresh_token", response.data.refresh_token, {
|
|
8462
|
-
maxAge: 2147483647,
|
|
8463
|
-
path: '/',
|
|
8464
|
-
domain: domainHost,
|
|
8465
|
-
secure: true
|
|
8466
|
-
});
|
|
8467
|
-
case 14:
|
|
8496
|
+
case 6:
|
|
8468
8497
|
case "end":
|
|
8469
8498
|
return _context2.stop();
|
|
8470
8499
|
}
|
|
@@ -8522,21 +8551,36 @@ var apiService = function apiService() {
|
|
|
8522
8551
|
// remove the access and refresh if invalid
|
|
8523
8552
|
{
|
|
8524
8553
|
domainHost = window.location.hostname.split('.').slice(-2).join('.');
|
|
8525
|
-
|
|
8526
|
-
maxAge: 2147483647,
|
|
8554
|
+
_jsCookie["default"].remove('access_token', {
|
|
8527
8555
|
path: '/',
|
|
8528
8556
|
domain: domainHost
|
|
8529
8557
|
});
|
|
8530
|
-
|
|
8531
|
-
maxAge: 2147483647,
|
|
8558
|
+
_jsCookie["default"].remove('refresh_token', {
|
|
8532
8559
|
path: '/',
|
|
8533
8560
|
domain: domainHost
|
|
8534
8561
|
});
|
|
8535
|
-
|
|
8536
|
-
maxAge: 2147483647,
|
|
8562
|
+
_jsCookie["default"].remove('expires_in', {
|
|
8537
8563
|
path: '/',
|
|
8538
8564
|
domain: domainHost
|
|
8539
8565
|
});
|
|
8566
|
+
|
|
8567
|
+
// destroyCookie(null, "access_token", {
|
|
8568
|
+
// maxAge: 2147483647,
|
|
8569
|
+
// path: '/',
|
|
8570
|
+
// domain: domainHost
|
|
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
|
+
// });
|
|
8540
8584
|
}
|
|
8541
8585
|
return _context3.abrupt("return", Promise.reject(error));
|
|
8542
8586
|
case 10:
|
|
@@ -8691,7 +8735,7 @@ var apiService = function apiService() {
|
|
|
8691
8735
|
while (1) switch (_context8.prev = _context8.next) {
|
|
8692
8736
|
case 0:
|
|
8693
8737
|
_context8.prev = 0;
|
|
8694
|
-
accessToken =
|
|
8738
|
+
accessToken = _jsCookie["default"].get('access_token') || null;
|
|
8695
8739
|
if (!accessToken) {
|
|
8696
8740
|
_context8.next = 11;
|
|
8697
8741
|
break;
|
|
@@ -8891,7 +8935,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8891
8935
|
});
|
|
8892
8936
|
exports.authService = void 0;
|
|
8893
8937
|
var _react = _interopRequireDefault(require("react"));
|
|
8894
|
-
var
|
|
8938
|
+
var _jsCookie = _interopRequireDefault(require("js-cookie"));
|
|
8895
8939
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
8896
8940
|
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; }
|
|
8897
8941
|
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); } }
|
|
@@ -9084,21 +9128,37 @@ var authService = function authService() {
|
|
|
9084
9128
|
redirectUri = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : null;
|
|
9085
9129
|
domainHost = window.location.hostname.split('.').slice(-2).join('.');
|
|
9086
9130
|
AuthUri = process.env.authorityUri;
|
|
9087
|
-
|
|
9088
|
-
maxAge: 2147483647,
|
|
9131
|
+
_jsCookie["default"].remove('access_token', {
|
|
9089
9132
|
path: '/',
|
|
9090
9133
|
domain: domainHost
|
|
9091
9134
|
});
|
|
9092
|
-
|
|
9093
|
-
maxAge: 2147483647,
|
|
9135
|
+
_jsCookie["default"].remove('refresh_token', {
|
|
9094
9136
|
path: '/',
|
|
9095
9137
|
domain: domainHost
|
|
9096
9138
|
});
|
|
9097
|
-
|
|
9098
|
-
maxAge: 2147483647,
|
|
9139
|
+
_jsCookie["default"].remove('expires_in', {
|
|
9099
9140
|
path: '/',
|
|
9100
9141
|
domain: domainHost
|
|
9101
9142
|
});
|
|
9143
|
+
|
|
9144
|
+
// destroyCookie({}, "access_token", {
|
|
9145
|
+
// maxAge: 2147483647,
|
|
9146
|
+
// path: '/',
|
|
9147
|
+
// domain: domainHost
|
|
9148
|
+
// });
|
|
9149
|
+
|
|
9150
|
+
// destroyCookie({}, "refresh_token", {
|
|
9151
|
+
// maxAge: 2147483647,
|
|
9152
|
+
// path: '/',
|
|
9153
|
+
// domain: domainHost
|
|
9154
|
+
// });
|
|
9155
|
+
|
|
9156
|
+
// destroyCookie({}, "expires_in", {
|
|
9157
|
+
// maxAge: 2147483647,
|
|
9158
|
+
// path: '/',
|
|
9159
|
+
// domain: domainHost
|
|
9160
|
+
// });
|
|
9161
|
+
|
|
9102
9162
|
setTimeout(function () {
|
|
9103
9163
|
if (redirectUri == null) {
|
|
9104
9164
|
window.location.href = AuthUri + "/connect/logout?redirect=" + window.location.href;
|
|
@@ -9202,7 +9262,7 @@ exports.signInValidator = void 0;
|
|
|
9202
9262
|
var _react = _interopRequireWildcard(require("react"));
|
|
9203
9263
|
var _axios = _interopRequireDefault(require("axios"));
|
|
9204
9264
|
var _queryString = _interopRequireDefault(require("query-string"));
|
|
9205
|
-
var
|
|
9265
|
+
var _jsCookie = _interopRequireDefault(require("js-cookie"));
|
|
9206
9266
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
9207
9267
|
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); }
|
|
9208
9268
|
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; }
|
|
@@ -9217,7 +9277,7 @@ var signInValidator = /*#__PURE__*/function () {
|
|
|
9217
9277
|
case 0:
|
|
9218
9278
|
codeVerifier = window.localStorage.getItem("verifier");
|
|
9219
9279
|
if (!(queryCode != null && codeVerifier != null)) {
|
|
9220
|
-
_context.next =
|
|
9280
|
+
_context.next = 15;
|
|
9221
9281
|
break;
|
|
9222
9282
|
}
|
|
9223
9283
|
headers = {
|
|
@@ -9239,30 +9299,48 @@ var signInValidator = /*#__PURE__*/function () {
|
|
|
9239
9299
|
response = _context.sent;
|
|
9240
9300
|
domainHost = window.location.hostname.split('.').slice(-2).join('.');
|
|
9241
9301
|
window.localStorage.removeItem("verifier");
|
|
9242
|
-
|
|
9243
|
-
return (0, _nookies.setCookie)(null, "access_token", response.data.access_token, {
|
|
9302
|
+
_jsCookie["default"].set('access_token', response.data.access_token, {
|
|
9244
9303
|
maxAge: 2147483647,
|
|
9245
9304
|
path: '/',
|
|
9246
9305
|
domain: domainHost,
|
|
9247
9306
|
secure: true
|
|
9248
9307
|
});
|
|
9249
|
-
|
|
9250
|
-
_context.next = 13;
|
|
9251
|
-
return (0, _nookies.setCookie)(null, "expires_in", response.data.expires_in, {
|
|
9308
|
+
_jsCookie["default"].set('expires_in', response.data.expires_in, {
|
|
9252
9309
|
maxAge: 2147483647,
|
|
9253
9310
|
path: '/',
|
|
9254
9311
|
domain: domainHost,
|
|
9255
9312
|
secure: true
|
|
9256
9313
|
});
|
|
9257
|
-
|
|
9258
|
-
_context.next = 15;
|
|
9259
|
-
return (0, _nookies.setCookie)(null, "refresh_token", response.data.refresh_token, {
|
|
9314
|
+
_jsCookie["default"].set('refresh_token', response.data.refresh_token, {
|
|
9260
9315
|
maxAge: 2147483647,
|
|
9261
9316
|
path: '/',
|
|
9262
9317
|
domain: domainHost,
|
|
9263
9318
|
secure: true
|
|
9264
9319
|
});
|
|
9265
|
-
|
|
9320
|
+
|
|
9321
|
+
// await setCookie(null, "access_token", response.data.access_token,
|
|
9322
|
+
// {
|
|
9323
|
+
// maxAge: 2147483647,
|
|
9324
|
+
// path: '/',
|
|
9325
|
+
// domain: domainHost,
|
|
9326
|
+
// secure: true
|
|
9327
|
+
// });
|
|
9328
|
+
|
|
9329
|
+
// await setCookie(null, "expires_in", response.data.expires_in,
|
|
9330
|
+
// {
|
|
9331
|
+
// maxAge: 2147483647,
|
|
9332
|
+
// path: '/',
|
|
9333
|
+
// domain: domainHost,
|
|
9334
|
+
// secure: true
|
|
9335
|
+
// });
|
|
9336
|
+
|
|
9337
|
+
// await setCookie(null, "refresh_token", response.data.refresh_token,
|
|
9338
|
+
// {
|
|
9339
|
+
// maxAge: 2147483647,
|
|
9340
|
+
// path: '/',
|
|
9341
|
+
// domain: domainHost,
|
|
9342
|
+
// secure: true
|
|
9343
|
+
// });
|
|
9266
9344
|
redirectUri = localStorage.getItem("redirectUri");
|
|
9267
9345
|
localStorage.clear();
|
|
9268
9346
|
if (redirectUri != null) {
|
|
@@ -9270,7 +9348,7 @@ var signInValidator = /*#__PURE__*/function () {
|
|
|
9270
9348
|
} else {
|
|
9271
9349
|
window.location.href = "/";
|
|
9272
9350
|
}
|
|
9273
|
-
case
|
|
9351
|
+
case 15:
|
|
9274
9352
|
case "end":
|
|
9275
9353
|
return _context.stop();
|
|
9276
9354
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "authscape",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.656",
|
|
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
|
-
|
|
73
|
-
{
|
|
72
|
+
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
|
-
|
|
81
|
-
{
|
|
78
|
+
|
|
79
|
+
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
|
-
|
|
89
|
-
{
|
|
85
|
+
|
|
86
|
+
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")
|
|
@@ -30,7 +30,7 @@ export const GoogleMaps = ({apiKey, hasLoaded, children}) => {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
export const GoogleMapsHeatmap = ({apiKey, data = [], gradient, radius = 50, opacity = 0.6, overlay}) => {
|
|
33
|
+
export const GoogleMapsHeatmap = ({apiKey, data = [], gradient = null, radius = 50, opacity = 0.6, overlay}) => {
|
|
34
34
|
const [heatmapData, setHeatmapData] = useState(null);
|
|
35
35
|
const [hasLoaded, setHasLoaded] = useState(false);
|
|
36
36
|
|
|
@@ -41,13 +41,6 @@ export const GoogleMapsHeatmap = ({apiKey, data = [], gradient, radius = 50, opa
|
|
|
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 = 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 = Cookies.get('access_token') || '';
|
|
41
|
+
let refreshToken = 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
|
+
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
|
-
|
|
70
|
-
{
|
|
71
|
+
|
|
72
|
+
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
|
-
|
|
78
|
-
{
|
|
78
|
+
|
|
79
|
+
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
|
+
Cookies.remove('access_token', { path: '/', domain: domainHost });
|
|
158
|
+
Cookies.remove('refresh_token', { path: '/', domain: domainHost });
|
|
159
|
+
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
|
+
Cookies.remove('access_token', { path: '/', domain: domainHost });
|
|
121
|
+
Cookies.remove('refresh_token', { path: '/', domain: domainHost });
|
|
122
|
+
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
|
+
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
|
-
|
|
38
|
-
{
|
|
37
|
+
|
|
38
|
+
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
secure: true
|
|
44
|
+
|
|
45
|
+
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)
|