@spidy092/auth-client 2.0.6 → 2.0.7
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/core.js +7 -24
- package/package.json +1 -1
package/core.js
CHANGED
|
@@ -196,30 +196,13 @@ export function handleCallback() {
|
|
|
196
196
|
});
|
|
197
197
|
|
|
198
198
|
// ✅ Validate state parameter
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
throw new Error('Invalid state parameter - authentication may have been compromised');
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
// Check state age (prevent replay attacks)
|
|
210
|
-
const stateTimestamp = parseInt(sessionStorage.getItem('pkce_timestamp') || '0', 10);
|
|
211
|
-
const stateAge = Date.now() - stateTimestamp;
|
|
212
|
-
const MAX_STATE_AGE = 10 * 60 * 1000; // 10 minutes
|
|
213
|
-
|
|
214
|
-
if (stateAge > MAX_STATE_AGE) {
|
|
215
|
-
console.error('❌ State expired', { stateAge });
|
|
216
|
-
throw new Error('Authentication state expired - please try again');
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
// Clear state after validation
|
|
220
|
-
sessionStorage.removeItem('oauth_state');
|
|
221
|
-
sessionStorage.removeItem('pkce_timestamp');
|
|
222
|
-
}
|
|
199
|
+
if (state) {
|
|
200
|
+
console.warn("⚠️ State returned but validation disabled (demo mode)");
|
|
201
|
+
|
|
202
|
+
// Clean up any existing stored state
|
|
203
|
+
sessionStorage.removeItem('oauth_state');
|
|
204
|
+
sessionStorage.removeItem('pkce_timestamp');
|
|
205
|
+
}
|
|
223
206
|
|
|
224
207
|
// ✅ Prevent duplicate callback processing
|
|
225
208
|
if (callbackProcessed) {
|