authscape 1.0.760 → 1.0.762
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 +14 -38
- package/package.json +1 -1
- package/src/components/AuthScapeApp.js +6 -21
package/index.js
CHANGED
|
@@ -110,13 +110,10 @@ function AuthScapeApp(_ref) {
|
|
|
110
110
|
var queryCode = searchParams.get("code");
|
|
111
111
|
var pathname = (0, _navigation.usePathname)();
|
|
112
112
|
|
|
113
|
-
// Check if we're on the signin-oidc page
|
|
114
|
-
var isOnSignInPage = pathname === "/signin-oidc";
|
|
115
|
-
|
|
116
113
|
// ----- PKCE Sign-in (browser-only) -----
|
|
117
114
|
var signInValidator = /*#__PURE__*/function () {
|
|
118
115
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(codeFromQuery) {
|
|
119
|
-
var codeVerifier, headers, body, response, domainHost, redirectUri
|
|
116
|
+
var codeVerifier, headers, body, response, domainHost, redirectUri;
|
|
120
117
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
121
118
|
while (1) switch (_context.prev = _context.next) {
|
|
122
119
|
case 0:
|
|
@@ -193,45 +190,24 @@ function AuthScapeApp(_ref) {
|
|
|
193
190
|
redirectUri = window.localStorage.getItem("redirectUri") || "/";
|
|
194
191
|
window.localStorage.clear();
|
|
195
192
|
|
|
196
|
-
//
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
_context.prev = 28;
|
|
201
|
-
_context.next = 31;
|
|
202
|
-
return module.exports.apiService().GetCurrentUser();
|
|
203
|
-
case 31:
|
|
204
|
-
usr = _context.sent;
|
|
205
|
-
signedInUser.current = ensureUserHelpers(usr);
|
|
206
|
-
setSignedInUserState(signedInUser.current);
|
|
207
|
-
setFrontEndLoadedState(true);
|
|
208
|
-
|
|
209
|
-
// Trigger a soft navigation using Next.js router
|
|
210
|
-
_router["default"].replace(redirectUri, undefined, {
|
|
211
|
-
shallow: false
|
|
212
|
-
});
|
|
213
|
-
_context.next = 41;
|
|
214
|
-
break;
|
|
215
|
-
case 38:
|
|
216
|
-
_context.prev = 38;
|
|
217
|
-
_context.t0 = _context["catch"](28);
|
|
218
|
-
// If we can't get user, still navigate
|
|
219
|
-
_router["default"].replace(redirectUri);
|
|
220
|
-
case 41:
|
|
221
|
-
_context.next = 48;
|
|
193
|
+
// Navigate to the redirect URI - use window.location for a clean page load
|
|
194
|
+
// This ensures all state is properly initialized on the target page
|
|
195
|
+
window.location.href = redirectUri;
|
|
196
|
+
_context.next = 36;
|
|
222
197
|
break;
|
|
223
|
-
case
|
|
224
|
-
_context.prev =
|
|
225
|
-
_context.
|
|
226
|
-
console.error("PKCE sign-in failed", _context.
|
|
198
|
+
case 30:
|
|
199
|
+
_context.prev = 30;
|
|
200
|
+
_context.t0 = _context["catch"](13);
|
|
201
|
+
console.error("PKCE sign-in failed", _context.t0);
|
|
227
202
|
// Invalid code - clear storage and redirect to login
|
|
228
203
|
window.localStorage.clear();
|
|
204
|
+
setIsSigningIn(false);
|
|
229
205
|
module.exports.authService().login();
|
|
230
|
-
case
|
|
206
|
+
case 36:
|
|
231
207
|
case "end":
|
|
232
208
|
return _context.stop();
|
|
233
209
|
}
|
|
234
|
-
}, _callee, null, [[13,
|
|
210
|
+
}, _callee, null, [[13, 30]]);
|
|
235
211
|
}));
|
|
236
212
|
return function signInValidator(_x) {
|
|
237
213
|
return _ref2.apply(this, arguments);
|
|
@@ -389,8 +365,8 @@ function AuthScapeApp(_ref) {
|
|
|
389
365
|
}
|
|
390
366
|
}, "Signing in..."), /*#__PURE__*/_react["default"].createElement("style", null, "\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "));
|
|
391
367
|
|
|
392
|
-
// Show loading screen when
|
|
393
|
-
if (
|
|
368
|
+
// Show loading screen when signing in
|
|
369
|
+
if (isSigningIn) {
|
|
394
370
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_head["default"], null, /*#__PURE__*/_react["default"].createElement("meta", {
|
|
395
371
|
name: "viewport",
|
|
396
372
|
content: "width=device-width, initial-scale=0.86, maximum-scale=5.0, minimum-scale=0.86"
|
package/package.json
CHANGED
|
@@ -81,9 +81,6 @@ export function AuthScapeApp({
|
|
|
81
81
|
const queryCode = searchParams.get("code");
|
|
82
82
|
const pathname = usePathname();
|
|
83
83
|
|
|
84
|
-
// Check if we're on the signin-oidc page
|
|
85
|
-
const isOnSignInPage = pathname === "/signin-oidc";
|
|
86
|
-
|
|
87
84
|
// ----- PKCE Sign-in (browser-only) -----
|
|
88
85
|
const signInValidator = async (codeFromQuery) => {
|
|
89
86
|
if (queryCodeUsed.current === codeFromQuery) return;
|
|
@@ -146,26 +143,14 @@ export function AuthScapeApp({
|
|
|
146
143
|
const redirectUri = window.localStorage.getItem("redirectUri") || "/";
|
|
147
144
|
window.localStorage.clear();
|
|
148
145
|
|
|
149
|
-
//
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
// Now load the current user and update state
|
|
153
|
-
try {
|
|
154
|
-
const usr = await module.exports.apiService().GetCurrentUser();
|
|
155
|
-
signedInUser.current = ensureUserHelpers(usr);
|
|
156
|
-
setSignedInUserState(signedInUser.current);
|
|
157
|
-
setFrontEndLoadedState(true);
|
|
158
|
-
|
|
159
|
-
// Trigger a soft navigation using Next.js router
|
|
160
|
-
Router.replace(redirectUri, undefined, { shallow: false });
|
|
161
|
-
} catch (userErr) {
|
|
162
|
-
// If we can't get user, still navigate
|
|
163
|
-
Router.replace(redirectUri);
|
|
164
|
-
}
|
|
146
|
+
// Navigate to the redirect URI - use window.location for a clean page load
|
|
147
|
+
// This ensures all state is properly initialized on the target page
|
|
148
|
+
window.location.href = redirectUri;
|
|
165
149
|
} catch (exp) {
|
|
166
150
|
console.error("PKCE sign-in failed", exp);
|
|
167
151
|
// Invalid code - clear storage and redirect to login
|
|
168
152
|
window.localStorage.clear();
|
|
153
|
+
setIsSigningIn(false);
|
|
169
154
|
module.exports.authService().login();
|
|
170
155
|
}
|
|
171
156
|
};
|
|
@@ -307,8 +292,8 @@ export function AuthScapeApp({
|
|
|
307
292
|
</div>
|
|
308
293
|
);
|
|
309
294
|
|
|
310
|
-
// Show loading screen when
|
|
311
|
-
if (
|
|
295
|
+
// Show loading screen when signing in
|
|
296
|
+
if (isSigningIn) {
|
|
312
297
|
return (
|
|
313
298
|
<>
|
|
314
299
|
<Head>
|