@hotosm/hanko-auth 0.3.2 → 0.3.3
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/dist/hanko-auth.esm.js +297 -288
- package/dist/hanko-auth.iife.js +4 -4
- package/dist/hanko-auth.umd.js +4 -4
- package/package.json +1 -1
- package/src/hanko-auth.ts +22 -1
package/package.json
CHANGED
package/src/hanko-auth.ts
CHANGED
|
@@ -607,10 +607,17 @@ export class HankoAuth extends LitElement {
|
|
|
607
607
|
// Configure cookie domain for cross-subdomain SSO
|
|
608
608
|
const hostname = window.location.hostname;
|
|
609
609
|
const isLocalhost = hostname === "localhost" || hostname === "127.0.0.1";
|
|
610
|
+
|
|
611
|
+
// Extract base domain for cookie (e.g., "login.hotosm.org" -> ".hotosm.org")
|
|
612
|
+
// Handles both production (.hotosm.org) and dev (.hotosm.test)
|
|
613
|
+
const parts = hostname.split(".");
|
|
614
|
+
const baseDomain =
|
|
615
|
+
parts.length >= 2 ? `.${parts.slice(-2).join(".")}` : hostname;
|
|
616
|
+
|
|
610
617
|
const cookieOptions = isLocalhost
|
|
611
618
|
? {}
|
|
612
619
|
: {
|
|
613
|
-
cookieDomain:
|
|
620
|
+
cookieDomain: baseDomain,
|
|
614
621
|
cookieName: "hanko",
|
|
615
622
|
cookieSameSite: "lax",
|
|
616
623
|
};
|
|
@@ -818,6 +825,12 @@ export class HankoAuth extends LitElement {
|
|
|
818
825
|
}
|
|
819
826
|
|
|
820
827
|
private async checkOSMConnection() {
|
|
828
|
+
// Skip OSM check if not required
|
|
829
|
+
if (!this.osmRequired) {
|
|
830
|
+
this.log("⏭️ OSM not required, skipping connection check");
|
|
831
|
+
return;
|
|
832
|
+
}
|
|
833
|
+
|
|
821
834
|
if (this.osmConnected) {
|
|
822
835
|
this.log("⏭️ Already connected to OSM, skipping check");
|
|
823
836
|
return;
|
|
@@ -1350,8 +1363,16 @@ export class HankoAuth extends LitElement {
|
|
|
1350
1363
|
this.log("📊 Current state:", {
|
|
1351
1364
|
user: this.user,
|
|
1352
1365
|
osmConnected: this.osmConnected,
|
|
1366
|
+
loading: this.loading,
|
|
1353
1367
|
});
|
|
1354
1368
|
|
|
1369
|
+
// If still loading, wait for session check to complete before acting
|
|
1370
|
+
// The SDK may fire this event for old/stale sessions during init
|
|
1371
|
+
if (this.loading) {
|
|
1372
|
+
this.log("⏳ Still loading, ignoring session expired event during init");
|
|
1373
|
+
return;
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1355
1376
|
// If we have an active user, the session is still valid
|
|
1356
1377
|
// The SDK may fire this event for old/stale sessions while a new session exists
|
|
1357
1378
|
if (this.user) {
|