authscape 1.0.227 → 1.0.229
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 +26 -40
- package/package.json +1 -1
- package/src/services/apiService.js +6 -10
- package/src/services/authService.js +3 -7
- package/src/services/signInValidator.js +6 -11
package/index.js
CHANGED
|
@@ -2453,7 +2453,7 @@ var setupDefaultOptions = /*#__PURE__*/function () {
|
|
|
2453
2453
|
}();
|
|
2454
2454
|
var RefreshToken = /*#__PURE__*/function () {
|
|
2455
2455
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(originalRequest, instance) {
|
|
2456
|
-
var accessToken, refreshToken, response
|
|
2456
|
+
var accessToken, refreshToken, response;
|
|
2457
2457
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
2458
2458
|
while (1) switch (_context2.prev = _context2.next) {
|
|
2459
2459
|
case 0:
|
|
@@ -2474,38 +2474,34 @@ var RefreshToken = /*#__PURE__*/function () {
|
|
|
2474
2474
|
case 4:
|
|
2475
2475
|
response = _context2.sent;
|
|
2476
2476
|
if (!(response != null && response.status == 200)) {
|
|
2477
|
-
_context2.next =
|
|
2477
|
+
_context2.next = 13;
|
|
2478
2478
|
break;
|
|
2479
2479
|
}
|
|
2480
|
-
baseURL = window.location.origin;
|
|
2481
2480
|
originalRequest.headers['Authorization'] = 'Bearer ' + response.data.access_token;
|
|
2482
|
-
_context2.next =
|
|
2481
|
+
_context2.next = 9;
|
|
2483
2482
|
return (0, _nookies.setCookie)(null, "access_token", response.data.access_token, {
|
|
2484
2483
|
maxAge: 2147483647,
|
|
2485
2484
|
path: '/',
|
|
2486
|
-
domain:
|
|
2487
|
-
//process.env.cookieDomain,
|
|
2485
|
+
domain: window.location.host,
|
|
2488
2486
|
secure: true
|
|
2489
2487
|
});
|
|
2490
|
-
case
|
|
2491
|
-
_context2.next =
|
|
2488
|
+
case 9:
|
|
2489
|
+
_context2.next = 11;
|
|
2492
2490
|
return (0, _nookies.setCookie)(null, "expires_in", response.data.expires_in, {
|
|
2493
2491
|
maxAge: 2147483647,
|
|
2494
2492
|
path: '/',
|
|
2495
|
-
domain:
|
|
2496
|
-
//process.env.cookieDomain,
|
|
2493
|
+
domain: window.location.host,
|
|
2497
2494
|
secure: true
|
|
2498
2495
|
});
|
|
2499
|
-
case
|
|
2500
|
-
_context2.next =
|
|
2496
|
+
case 11:
|
|
2497
|
+
_context2.next = 13;
|
|
2501
2498
|
return (0, _nookies.setCookie)(null, "refresh_token", response.data.refresh_token, {
|
|
2502
2499
|
maxAge: 2147483647,
|
|
2503
2500
|
path: '/',
|
|
2504
|
-
domain:
|
|
2505
|
-
//process.env.cookieDomain,
|
|
2501
|
+
domain: window.location.host,
|
|
2506
2502
|
secure: true
|
|
2507
2503
|
});
|
|
2508
|
-
case
|
|
2504
|
+
case 13:
|
|
2509
2505
|
case "end":
|
|
2510
2506
|
return _context2.stop();
|
|
2511
2507
|
}
|
|
@@ -2532,7 +2528,7 @@ var apiService = function apiService() {
|
|
|
2532
2528
|
return response;
|
|
2533
2529
|
}, /*#__PURE__*/function () {
|
|
2534
2530
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(error) {
|
|
2535
|
-
var originalConfig
|
|
2531
|
+
var originalConfig;
|
|
2536
2532
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
2537
2533
|
while (1) switch (_context3.prev = _context3.next) {
|
|
2538
2534
|
case 0:
|
|
@@ -2562,23 +2558,20 @@ var apiService = function apiService() {
|
|
|
2562
2558
|
if (error.response.config.url.includes("/connect/token"))
|
|
2563
2559
|
// remove the access and refresh if invalid
|
|
2564
2560
|
{
|
|
2565
|
-
baseURL = window.location.origin;
|
|
2566
2561
|
(0, _nookies.destroyCookie)(null, "access_token", {
|
|
2567
2562
|
maxAge: 2147483647,
|
|
2568
2563
|
path: '/',
|
|
2569
|
-
domain:
|
|
2564
|
+
domain: window.location.host
|
|
2570
2565
|
});
|
|
2571
|
-
|
|
2572
2566
|
(0, _nookies.destroyCookie)(null, "refresh_token", {
|
|
2573
2567
|
maxAge: 2147483647,
|
|
2574
2568
|
path: '/',
|
|
2575
|
-
domain:
|
|
2569
|
+
domain: window.location.host
|
|
2576
2570
|
});
|
|
2577
|
-
|
|
2578
2571
|
(0, _nookies.destroyCookie)(null, "expires_in", {
|
|
2579
2572
|
maxAge: 2147483647,
|
|
2580
2573
|
path: '/',
|
|
2581
|
-
domain:
|
|
2574
|
+
domain: window.location.host
|
|
2582
2575
|
});
|
|
2583
2576
|
}
|
|
2584
2577
|
return _context3.abrupt("return", Promise.reject(error));
|
|
@@ -3032,29 +3025,27 @@ var authService = function authService() {
|
|
|
3032
3025
|
logout: function () {
|
|
3033
3026
|
var _logout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
3034
3027
|
var redirectUri,
|
|
3035
|
-
cookieDomain,
|
|
3036
3028
|
AuthUri,
|
|
3037
3029
|
_args4 = arguments;
|
|
3038
3030
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
3039
3031
|
while (1) switch (_context4.prev = _context4.next) {
|
|
3040
3032
|
case 0:
|
|
3041
3033
|
redirectUri = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : null;
|
|
3042
|
-
|
|
3043
|
-
AuthUri = process.env.authorityUri; //let cookieDomain = process.env.cookieDomain;
|
|
3034
|
+
AuthUri = process.env.authorityUri;
|
|
3044
3035
|
(0, _nookies.destroyCookie)({}, "access_token", {
|
|
3045
3036
|
maxAge: 2147483647,
|
|
3046
3037
|
path: '/',
|
|
3047
|
-
domain:
|
|
3038
|
+
domain: window.location.host
|
|
3048
3039
|
});
|
|
3049
3040
|
(0, _nookies.destroyCookie)({}, "refresh_token", {
|
|
3050
3041
|
maxAge: 2147483647,
|
|
3051
3042
|
path: '/',
|
|
3052
|
-
domain:
|
|
3043
|
+
domain: window.location.host
|
|
3053
3044
|
});
|
|
3054
3045
|
(0, _nookies.destroyCookie)({}, "expires_in", {
|
|
3055
3046
|
maxAge: 2147483647,
|
|
3056
3047
|
path: '/',
|
|
3057
|
-
domain:
|
|
3048
|
+
domain: window.location.host
|
|
3058
3049
|
});
|
|
3059
3050
|
setTimeout(function () {
|
|
3060
3051
|
if (redirectUri == null) {
|
|
@@ -3063,7 +3054,7 @@ var authService = function authService() {
|
|
|
3063
3054
|
window.location.href = AuthUri + "/connect/logout?redirect=" + redirectUri;
|
|
3064
3055
|
}
|
|
3065
3056
|
}, 500);
|
|
3066
|
-
case
|
|
3057
|
+
case 6:
|
|
3067
3058
|
case "end":
|
|
3068
3059
|
return _context4.stop();
|
|
3069
3060
|
}
|
|
@@ -3179,33 +3170,28 @@ var signInValidator = /*#__PURE__*/function () {
|
|
|
3179
3170
|
case 6:
|
|
3180
3171
|
response = _context.sent;
|
|
3181
3172
|
window.localStorage.removeItem("verifier");
|
|
3182
|
-
|
|
3183
|
-
//let domain = process.env.cookieDomain;
|
|
3184
3173
|
_context.next = 10;
|
|
3185
3174
|
return (0, _nookies.setCookie)(null, "access_token", response.data.access_token, {
|
|
3186
3175
|
maxAge: 2147483647,
|
|
3187
3176
|
path: '/',
|
|
3188
|
-
domain: window.location.
|
|
3189
|
-
secure: true
|
|
3190
|
-
sameSite: false
|
|
3177
|
+
domain: window.location.host,
|
|
3178
|
+
secure: true
|
|
3191
3179
|
});
|
|
3192
3180
|
case 10:
|
|
3193
3181
|
_context.next = 12;
|
|
3194
3182
|
return (0, _nookies.setCookie)(null, "expires_in", response.data.expires_in, {
|
|
3195
3183
|
maxAge: 2147483647,
|
|
3196
3184
|
path: '/',
|
|
3197
|
-
domain: window.location.
|
|
3198
|
-
secure: true
|
|
3199
|
-
sameSite: false
|
|
3185
|
+
domain: window.location.host,
|
|
3186
|
+
secure: true
|
|
3200
3187
|
});
|
|
3201
3188
|
case 12:
|
|
3202
3189
|
_context.next = 14;
|
|
3203
3190
|
return (0, _nookies.setCookie)(null, "refresh_token", response.data.refresh_token, {
|
|
3204
3191
|
maxAge: 2147483647,
|
|
3205
3192
|
path: '/',
|
|
3206
|
-
domain: window.location.
|
|
3207
|
-
secure: true
|
|
3208
|
-
sameSite: false
|
|
3193
|
+
domain: window.location.host,
|
|
3194
|
+
secure: true
|
|
3209
3195
|
});
|
|
3210
3196
|
case 14:
|
|
3211
3197
|
redirectUri = localStorage.getItem("redirectUri");
|
package/package.json
CHANGED
|
@@ -55,15 +55,13 @@ const RefreshToken = async (originalRequest, instance) => {
|
|
|
55
55
|
|
|
56
56
|
if (response != null && response.status == 200)
|
|
57
57
|
{
|
|
58
|
-
var baseURL = window.location.origin;
|
|
59
|
-
|
|
60
58
|
originalRequest.headers['Authorization'] = 'Bearer ' + response.data.access_token;
|
|
61
59
|
|
|
62
60
|
await setCookie(null, "access_token", response.data.access_token,
|
|
63
61
|
{
|
|
64
62
|
maxAge: 2147483647,
|
|
65
63
|
path: '/',
|
|
66
|
-
domain:
|
|
64
|
+
domain: window.location.host,
|
|
67
65
|
secure: true
|
|
68
66
|
});
|
|
69
67
|
|
|
@@ -71,7 +69,7 @@ const RefreshToken = async (originalRequest, instance) => {
|
|
|
71
69
|
{
|
|
72
70
|
maxAge: 2147483647,
|
|
73
71
|
path: '/',
|
|
74
|
-
domain:
|
|
72
|
+
domain: window.location.host,
|
|
75
73
|
secure: true
|
|
76
74
|
});
|
|
77
75
|
|
|
@@ -79,7 +77,7 @@ const RefreshToken = async (originalRequest, instance) => {
|
|
|
79
77
|
{
|
|
80
78
|
maxAge: 2147483647,
|
|
81
79
|
path: '/',
|
|
82
|
-
domain:
|
|
80
|
+
domain: window.location.host,
|
|
83
81
|
secure: true
|
|
84
82
|
});
|
|
85
83
|
}
|
|
@@ -125,24 +123,22 @@ export const apiService = (ctx = null) => {
|
|
|
125
123
|
|
|
126
124
|
if (error.response.config.url.includes("/connect/token")) // remove the access and refresh if invalid
|
|
127
125
|
{
|
|
128
|
-
var baseURL = window.location.origin;
|
|
129
|
-
|
|
130
126
|
destroyCookie(null, "access_token", {
|
|
131
127
|
maxAge: 2147483647,
|
|
132
128
|
path: '/',
|
|
133
|
-
domain:
|
|
129
|
+
domain: window.location.host
|
|
134
130
|
});
|
|
135
131
|
|
|
136
132
|
destroyCookie(null, "refresh_token", {
|
|
137
133
|
maxAge: 2147483647,
|
|
138
134
|
path: '/',
|
|
139
|
-
domain:
|
|
135
|
+
domain: window.location.host
|
|
140
136
|
});
|
|
141
137
|
|
|
142
138
|
destroyCookie(null, "expires_in", {
|
|
143
139
|
maxAge: 2147483647,
|
|
144
140
|
path: '/',
|
|
145
|
-
domain:
|
|
141
|
+
domain: window.location.host
|
|
146
142
|
});
|
|
147
143
|
}
|
|
148
144
|
|
|
@@ -83,27 +83,23 @@ export const authService = () => {
|
|
|
83
83
|
},
|
|
84
84
|
logout: async (redirectUri = null) => {
|
|
85
85
|
|
|
86
|
-
var cookieDomain = window.location.origin;
|
|
87
|
-
|
|
88
86
|
let AuthUri = process.env.authorityUri;
|
|
89
|
-
//let cookieDomain = process.env.cookieDomain;
|
|
90
|
-
|
|
91
87
|
destroyCookie({}, "access_token", {
|
|
92
88
|
maxAge: 2147483647,
|
|
93
89
|
path: '/',
|
|
94
|
-
domain:
|
|
90
|
+
domain: window.location.host
|
|
95
91
|
});
|
|
96
92
|
|
|
97
93
|
destroyCookie({}, "refresh_token", {
|
|
98
94
|
maxAge: 2147483647,
|
|
99
95
|
path: '/',
|
|
100
|
-
domain:
|
|
96
|
+
domain: window.location.host
|
|
101
97
|
});
|
|
102
98
|
|
|
103
99
|
destroyCookie({}, "expires_in", {
|
|
104
100
|
maxAge: 2147483647,
|
|
105
101
|
path: '/',
|
|
106
|
-
domain:
|
|
102
|
+
domain: window.location.host
|
|
107
103
|
});
|
|
108
104
|
|
|
109
105
|
setTimeout(() => {
|
|
@@ -25,33 +25,28 @@ export const signInValidator = async (queryCode) => {
|
|
|
25
25
|
|
|
26
26
|
window.localStorage.removeItem("verifier");
|
|
27
27
|
|
|
28
|
-
//let domain = process.env.cookieDomain;
|
|
29
|
-
|
|
30
28
|
await setCookie(null, "access_token", response.data.access_token,
|
|
31
29
|
{
|
|
32
30
|
maxAge: 2147483647,
|
|
33
31
|
path: '/',
|
|
34
|
-
domain: window.location.
|
|
35
|
-
secure: true
|
|
36
|
-
sameSite: false
|
|
32
|
+
domain: window.location.host,
|
|
33
|
+
secure: true
|
|
37
34
|
});
|
|
38
35
|
|
|
39
36
|
await setCookie(null, "expires_in", response.data.expires_in,
|
|
40
37
|
{
|
|
41
38
|
maxAge: 2147483647,
|
|
42
39
|
path: '/',
|
|
43
|
-
domain: window.location.
|
|
44
|
-
secure: true
|
|
45
|
-
sameSite: false
|
|
40
|
+
domain: window.location.host,
|
|
41
|
+
secure: true
|
|
46
42
|
});
|
|
47
43
|
|
|
48
44
|
await setCookie(null, "refresh_token", response.data.refresh_token,
|
|
49
45
|
{
|
|
50
46
|
maxAge: 2147483647,
|
|
51
47
|
path: '/',
|
|
52
|
-
domain: window.location.
|
|
53
|
-
secure: true
|
|
54
|
-
sameSite: false
|
|
48
|
+
domain: window.location.host,
|
|
49
|
+
secure: true
|
|
55
50
|
});
|
|
56
51
|
|
|
57
52
|
|