authscape 1.0.224 → 1.0.227
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 +21 -19
- package/package.json +1 -1
- package/src/services/apiService.js +2 -2
- package/src/services/authService.js +1 -1
- package/src/services/signInValidator.js +9 -7
package/index.js
CHANGED
|
@@ -2477,7 +2477,7 @@ var RefreshToken = /*#__PURE__*/function () {
|
|
|
2477
2477
|
_context2.next = 14;
|
|
2478
2478
|
break;
|
|
2479
2479
|
}
|
|
2480
|
-
baseURL = window.location.
|
|
2480
|
+
baseURL = window.location.origin;
|
|
2481
2481
|
originalRequest.headers['Authorization'] = 'Bearer ' + response.data.access_token;
|
|
2482
2482
|
_context2.next = 10;
|
|
2483
2483
|
return (0, _nookies.setCookie)(null, "access_token", response.data.access_token, {
|
|
@@ -2562,7 +2562,7 @@ var apiService = function apiService() {
|
|
|
2562
2562
|
if (error.response.config.url.includes("/connect/token"))
|
|
2563
2563
|
// remove the access and refresh if invalid
|
|
2564
2564
|
{
|
|
2565
|
-
baseURL = window.location.
|
|
2565
|
+
baseURL = window.location.origin;
|
|
2566
2566
|
(0, _nookies.destroyCookie)(null, "access_token", {
|
|
2567
2567
|
maxAge: 2147483647,
|
|
2568
2568
|
path: '/',
|
|
@@ -3039,7 +3039,7 @@ var authService = function authService() {
|
|
|
3039
3039
|
while (1) switch (_context4.prev = _context4.next) {
|
|
3040
3040
|
case 0:
|
|
3041
3041
|
redirectUri = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : null;
|
|
3042
|
-
cookieDomain = window.location.
|
|
3042
|
+
cookieDomain = window.location.origin;
|
|
3043
3043
|
AuthUri = process.env.authorityUri; //let cookieDomain = process.env.cookieDomain;
|
|
3044
3044
|
(0, _nookies.destroyCookie)({}, "access_token", {
|
|
3045
3045
|
maxAge: 2147483647,
|
|
@@ -3152,13 +3152,13 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
|
3152
3152
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
3153
3153
|
var signInValidator = /*#__PURE__*/function () {
|
|
3154
3154
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(queryCode) {
|
|
3155
|
-
var codeVerifier, headers, queryString, response,
|
|
3155
|
+
var codeVerifier, headers, queryString, response, redirectUri;
|
|
3156
3156
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3157
3157
|
while (1) switch (_context.prev = _context.next) {
|
|
3158
3158
|
case 0:
|
|
3159
3159
|
codeVerifier = window.localStorage.getItem("verifier");
|
|
3160
3160
|
if (!(queryCode != null && codeVerifier != null)) {
|
|
3161
|
-
_context.next =
|
|
3161
|
+
_context.next = 17;
|
|
3162
3162
|
break;
|
|
3163
3163
|
}
|
|
3164
3164
|
headers = {
|
|
@@ -3181,31 +3181,33 @@ var signInValidator = /*#__PURE__*/function () {
|
|
|
3181
3181
|
window.localStorage.removeItem("verifier");
|
|
3182
3182
|
|
|
3183
3183
|
//let domain = process.env.cookieDomain;
|
|
3184
|
-
|
|
3185
|
-
_context.next = 11;
|
|
3184
|
+
_context.next = 10;
|
|
3186
3185
|
return (0, _nookies.setCookie)(null, "access_token", response.data.access_token, {
|
|
3187
3186
|
maxAge: 2147483647,
|
|
3188
3187
|
path: '/',
|
|
3189
|
-
domain:
|
|
3190
|
-
secure: true
|
|
3188
|
+
domain: window.location.origin,
|
|
3189
|
+
secure: true,
|
|
3190
|
+
sameSite: false
|
|
3191
3191
|
});
|
|
3192
|
-
case
|
|
3193
|
-
_context.next =
|
|
3192
|
+
case 10:
|
|
3193
|
+
_context.next = 12;
|
|
3194
3194
|
return (0, _nookies.setCookie)(null, "expires_in", response.data.expires_in, {
|
|
3195
3195
|
maxAge: 2147483647,
|
|
3196
3196
|
path: '/',
|
|
3197
|
-
domain:
|
|
3198
|
-
secure: true
|
|
3197
|
+
domain: window.location.origin,
|
|
3198
|
+
secure: true,
|
|
3199
|
+
sameSite: false
|
|
3199
3200
|
});
|
|
3200
|
-
case
|
|
3201
|
-
_context.next =
|
|
3201
|
+
case 12:
|
|
3202
|
+
_context.next = 14;
|
|
3202
3203
|
return (0, _nookies.setCookie)(null, "refresh_token", response.data.refresh_token, {
|
|
3203
3204
|
maxAge: 2147483647,
|
|
3204
3205
|
path: '/',
|
|
3205
|
-
domain:
|
|
3206
|
-
secure: true
|
|
3206
|
+
domain: window.location.origin,
|
|
3207
|
+
secure: true,
|
|
3208
|
+
sameSite: false
|
|
3207
3209
|
});
|
|
3208
|
-
case
|
|
3210
|
+
case 14:
|
|
3209
3211
|
redirectUri = localStorage.getItem("redirectUri");
|
|
3210
3212
|
localStorage.clear();
|
|
3211
3213
|
if (redirectUri != null) {
|
|
@@ -3213,7 +3215,7 @@ var signInValidator = /*#__PURE__*/function () {
|
|
|
3213
3215
|
} else {
|
|
3214
3216
|
window.location.href = "/";
|
|
3215
3217
|
}
|
|
3216
|
-
case
|
|
3218
|
+
case 17:
|
|
3217
3219
|
case "end":
|
|
3218
3220
|
return _context.stop();
|
|
3219
3221
|
}
|
package/package.json
CHANGED
|
@@ -55,7 +55,7 @@ const RefreshToken = async (originalRequest, instance) => {
|
|
|
55
55
|
|
|
56
56
|
if (response != null && response.status == 200)
|
|
57
57
|
{
|
|
58
|
-
var baseURL = window.location.
|
|
58
|
+
var baseURL = window.location.origin;
|
|
59
59
|
|
|
60
60
|
originalRequest.headers['Authorization'] = 'Bearer ' + response.data.access_token;
|
|
61
61
|
|
|
@@ -125,7 +125,7 @@ export const apiService = (ctx = null) => {
|
|
|
125
125
|
|
|
126
126
|
if (error.response.config.url.includes("/connect/token")) // remove the access and refresh if invalid
|
|
127
127
|
{
|
|
128
|
-
var baseURL = window.location.
|
|
128
|
+
var baseURL = window.location.origin;
|
|
129
129
|
|
|
130
130
|
destroyCookie(null, "access_token", {
|
|
131
131
|
maxAge: 2147483647,
|
|
@@ -83,7 +83,7 @@ export const authService = () => {
|
|
|
83
83
|
},
|
|
84
84
|
logout: async (redirectUri = null) => {
|
|
85
85
|
|
|
86
|
-
var cookieDomain = window.location.
|
|
86
|
+
var cookieDomain = window.location.origin;
|
|
87
87
|
|
|
88
88
|
let AuthUri = process.env.authorityUri;
|
|
89
89
|
//let cookieDomain = process.env.cookieDomain;
|
|
@@ -26,30 +26,32 @@ export const signInValidator = async (queryCode) => {
|
|
|
26
26
|
window.localStorage.removeItem("verifier");
|
|
27
27
|
|
|
28
28
|
//let domain = process.env.cookieDomain;
|
|
29
|
-
var domain = window.location.protocol + "//" + window.location.host;
|
|
30
29
|
|
|
31
30
|
await setCookie(null, "access_token", response.data.access_token,
|
|
32
31
|
{
|
|
33
32
|
maxAge: 2147483647,
|
|
34
33
|
path: '/',
|
|
35
|
-
domain:
|
|
36
|
-
secure: true
|
|
34
|
+
domain: window.location.origin,
|
|
35
|
+
secure: true,
|
|
36
|
+
sameSite: false
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
await setCookie(null, "expires_in", response.data.expires_in,
|
|
40
40
|
{
|
|
41
41
|
maxAge: 2147483647,
|
|
42
42
|
path: '/',
|
|
43
|
-
domain:
|
|
44
|
-
secure: true
|
|
43
|
+
domain: window.location.origin,
|
|
44
|
+
secure: true,
|
|
45
|
+
sameSite: false
|
|
45
46
|
});
|
|
46
47
|
|
|
47
48
|
await setCookie(null, "refresh_token", response.data.refresh_token,
|
|
48
49
|
{
|
|
49
50
|
maxAge: 2147483647,
|
|
50
51
|
path: '/',
|
|
51
|
-
domain:
|
|
52
|
-
secure: true
|
|
52
|
+
domain: window.location.origin,
|
|
53
|
+
secure: true,
|
|
54
|
+
sameSite: false
|
|
53
55
|
});
|
|
54
56
|
|
|
55
57
|
|