@nauth-toolkit/client 0.1.100 → 0.1.102
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/index.cjs +11 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.mjs +11 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2755,6 +2755,9 @@ declare class NAuthClient {
|
|
|
2755
2755
|
* - In cookie delivery modes, httpOnly cookies can only be cleared by the backend; this method
|
|
2756
2756
|
* only clears client-side state (e.g., cached user + persisted tokens in JSON mode).
|
|
2757
2757
|
*
|
|
2758
|
+
* IMPORTANT: Also clears any pending challenge sessions to prevent ghost states where the UI
|
|
2759
|
+
* shows a challenge screen but the backend session is invalid.
|
|
2760
|
+
*
|
|
2758
2761
|
* @param options - Optional behavior flags
|
|
2759
2762
|
* @returns Promise that resolves when local state is cleared
|
|
2760
2763
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -2755,6 +2755,9 @@ declare class NAuthClient {
|
|
|
2755
2755
|
* - In cookie delivery modes, httpOnly cookies can only be cleared by the backend; this method
|
|
2756
2756
|
* only clears client-side state (e.g., cached user + persisted tokens in JSON mode).
|
|
2757
2757
|
*
|
|
2758
|
+
* IMPORTANT: Also clears any pending challenge sessions to prevent ghost states where the UI
|
|
2759
|
+
* shows a challenge screen but the backend session is invalid.
|
|
2760
|
+
*
|
|
2758
2761
|
* @param options - Optional behavior flags
|
|
2759
2762
|
* @returns Promise that resolves when local state is cleared
|
|
2760
2763
|
*
|
package/dist/index.mjs
CHANGED
|
@@ -1625,6 +1625,9 @@ var NAuthClient = class {
|
|
|
1625
1625
|
* - In cookie delivery modes, httpOnly cookies can only be cleared by the backend; this method
|
|
1626
1626
|
* only clears client-side state (e.g., cached user + persisted tokens in JSON mode).
|
|
1627
1627
|
*
|
|
1628
|
+
* IMPORTANT: Also clears any pending challenge sessions to prevent ghost states where the UI
|
|
1629
|
+
* shows a challenge screen but the backend session is invalid.
|
|
1630
|
+
*
|
|
1628
1631
|
* @param options - Optional behavior flags
|
|
1629
1632
|
* @returns Promise that resolves when local state is cleared
|
|
1630
1633
|
*
|
|
@@ -1636,6 +1639,7 @@ var NAuthClient = class {
|
|
|
1636
1639
|
*/
|
|
1637
1640
|
async clearLocalAuthState(options) {
|
|
1638
1641
|
await this.clearAuthState(options?.forgetDevice ?? false);
|
|
1642
|
+
await this.clearChallenge();
|
|
1639
1643
|
}
|
|
1640
1644
|
/**
|
|
1641
1645
|
* Logout current session.
|
|
@@ -1652,6 +1656,7 @@ var NAuthClient = class {
|
|
|
1652
1656
|
console.warn("[nauth] Logout request failed (session may already be invalid):", error);
|
|
1653
1657
|
} finally {
|
|
1654
1658
|
await this.clearAuthState(forgetDevice);
|
|
1659
|
+
await this.clearChallenge();
|
|
1655
1660
|
this.eventEmitter.emit({
|
|
1656
1661
|
type: "auth:logout",
|
|
1657
1662
|
data: { forgetDevice: !!forgetDevice, global: false },
|
|
@@ -1679,6 +1684,7 @@ var NAuthClient = class {
|
|
|
1679
1684
|
true
|
|
1680
1685
|
);
|
|
1681
1686
|
await this.clearAuthState(forgetDevices);
|
|
1687
|
+
await this.clearChallenge();
|
|
1682
1688
|
this.eventEmitter.emit({
|
|
1683
1689
|
type: "auth:logout",
|
|
1684
1690
|
data: { forgetDevice: !!forgetDevices, global: true },
|
|
@@ -1687,6 +1693,7 @@ var NAuthClient = class {
|
|
|
1687
1693
|
return { revokedCount: result.revokedCount };
|
|
1688
1694
|
} catch (error) {
|
|
1689
1695
|
await this.clearAuthState(forgetDevices);
|
|
1696
|
+
await this.clearChallenge();
|
|
1690
1697
|
this.eventEmitter.emit({
|
|
1691
1698
|
type: "auth:logout",
|
|
1692
1699
|
data: { forgetDevice: !!forgetDevices, global: true },
|
|
@@ -2263,6 +2270,10 @@ var NAuthClient = class {
|
|
|
2263
2270
|
if (forgetDevice && this.config.tokenDelivery === "json") {
|
|
2264
2271
|
await this.config.storage.removeItem(this.config.deviceTrust.storageKey);
|
|
2265
2272
|
}
|
|
2273
|
+
try {
|
|
2274
|
+
await this.oauthStorage.removeItem(OAUTH_STATE_KEY2);
|
|
2275
|
+
} catch {
|
|
2276
|
+
}
|
|
2266
2277
|
this.config.onAuthStateChange?.(null);
|
|
2267
2278
|
}
|
|
2268
2279
|
/**
|