authscape 1.0.20 → 1.0.22
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/package.json +1 -1
- package/services/apiService.js +0 -48
- package/services/authService.js +45 -1
package/package.json
CHANGED
package/services/apiService.js
CHANGED
|
@@ -97,7 +97,6 @@ const apiService = (ctx = {}) => {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
let baseUri = process.env.APIURI + "/api";
|
|
100
|
-
let AuthUri = process.env.AUTHORITYURI;
|
|
101
100
|
|
|
102
101
|
const instance = axios.create({
|
|
103
102
|
baseURL: baseUri,
|
|
@@ -206,53 +205,6 @@ const apiService = (ctx = {}) => {
|
|
|
206
205
|
return error.response;
|
|
207
206
|
}
|
|
208
207
|
},
|
|
209
|
-
login: async () => {
|
|
210
|
-
|
|
211
|
-
await signinRedirect(ctx);
|
|
212
|
-
},
|
|
213
|
-
logout: async () => {
|
|
214
|
-
|
|
215
|
-
let cookieDomain = process.env.cookieDomain;
|
|
216
|
-
|
|
217
|
-
destroyCookie(ctx, "access_token", {
|
|
218
|
-
maxAge: 2147483647,
|
|
219
|
-
path: '/',
|
|
220
|
-
domain: cookieDomain
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
destroyCookie(ctx, "refresh_token", {
|
|
224
|
-
maxAge: 2147483647,
|
|
225
|
-
path: '/',
|
|
226
|
-
domain: cookieDomain
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
destroyCookie(ctx, "expires_in", {
|
|
230
|
-
maxAge: 2147483647,
|
|
231
|
-
path: '/',
|
|
232
|
-
domain: cookieDomain
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
setTimeout(() => {
|
|
236
|
-
window.location.href = AuthUri + "/connect/logout?redirect=" + window.location.href;
|
|
237
|
-
}, 500);
|
|
238
|
-
|
|
239
|
-
},
|
|
240
|
-
signUp: (redirectUrl = null) => {
|
|
241
|
-
|
|
242
|
-
let url = "";
|
|
243
|
-
if (redirectUrl == null)
|
|
244
|
-
{
|
|
245
|
-
url = AuthUri + "/Account/Register?redirectUrl=" + window.location.href;
|
|
246
|
-
localStorage.setItem("redirectUri", window.location.href);
|
|
247
|
-
}
|
|
248
|
-
else
|
|
249
|
-
{
|
|
250
|
-
url = AuthUri + "/Account/Register?redirectUrl=" + redirectUrl;
|
|
251
|
-
localStorage.setItem("redirectUri", redirectUrl);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
window.location.href = url;
|
|
255
|
-
},
|
|
256
208
|
GetCurrentUser: async () => {
|
|
257
209
|
|
|
258
210
|
try
|
package/services/authService.js
CHANGED
|
@@ -58,7 +58,51 @@ const authService = () => {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
window.location.href = loginUri;
|
|
61
|
-
}
|
|
61
|
+
},
|
|
62
|
+
signUp: (redirectUrl = null) => {
|
|
63
|
+
|
|
64
|
+
let url = "";
|
|
65
|
+
if (redirectUrl == null)
|
|
66
|
+
{
|
|
67
|
+
url = AuthUri + "/Account/Register?redirectUrl=" + window.location.href;
|
|
68
|
+
localStorage.setItem("redirectUri", window.location.href);
|
|
69
|
+
}
|
|
70
|
+
else
|
|
71
|
+
{
|
|
72
|
+
url = AuthUri + "/Account/Register?redirectUrl=" + redirectUrl;
|
|
73
|
+
localStorage.setItem("redirectUri", redirectUrl);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
window.location.href = url;
|
|
77
|
+
},
|
|
78
|
+
logout: async () => {
|
|
79
|
+
|
|
80
|
+
let AuthUri = process.env.AUTHORITYURI;
|
|
81
|
+
let cookieDomain = process.env.cookieDomain;
|
|
82
|
+
|
|
83
|
+
destroyCookie(ctx, "access_token", {
|
|
84
|
+
maxAge: 2147483647,
|
|
85
|
+
path: '/',
|
|
86
|
+
domain: cookieDomain
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
destroyCookie(ctx, "refresh_token", {
|
|
90
|
+
maxAge: 2147483647,
|
|
91
|
+
path: '/',
|
|
92
|
+
domain: cookieDomain
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
destroyCookie(ctx, "expires_in", {
|
|
96
|
+
maxAge: 2147483647,
|
|
97
|
+
path: '/',
|
|
98
|
+
domain: cookieDomain
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
setTimeout(() => {
|
|
102
|
+
window.location.href = AuthUri + "/connect/logout?redirect=" + window.location.href;
|
|
103
|
+
}, 500);
|
|
104
|
+
|
|
105
|
+
},
|
|
62
106
|
}
|
|
63
107
|
}
|
|
64
108
|
|