@enfyra/sdk-nuxt 0.3.11 → 0.3.12
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/module.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { setCookie, getCookie } from "h3";
|
|
1
|
+
import { setCookie, getCookie, deleteCookie } from "h3";
|
|
2
2
|
import { $fetch } from "ofetch";
|
|
3
3
|
import {
|
|
4
4
|
ACCESS_TOKEN_KEY,
|
|
@@ -61,6 +61,9 @@ export async function refreshAccessToken(event, refreshToken, apiUrl) {
|
|
|
61
61
|
return newAccessToken;
|
|
62
62
|
} catch (error) {
|
|
63
63
|
console.warn("Token refresh failed:", error);
|
|
64
|
+
deleteCookie(event, ACCESS_TOKEN_KEY);
|
|
65
|
+
deleteCookie(event, REFRESH_TOKEN_KEY);
|
|
66
|
+
deleteCookie(event, EXP_TIME_KEY);
|
|
64
67
|
throw error;
|
|
65
68
|
}
|
|
66
69
|
}
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { setCookie, getCookie, type H3Event } from "h3";
|
|
1
|
+
import { setCookie, getCookie, deleteCookie, type H3Event } from "h3";
|
|
2
2
|
import { $fetch } from "ofetch";
|
|
3
3
|
import {
|
|
4
4
|
ACCESS_TOKEN_KEY,
|
|
@@ -84,6 +84,10 @@ export async function refreshAccessToken(
|
|
|
84
84
|
return newAccessToken;
|
|
85
85
|
} catch (error) {
|
|
86
86
|
console.warn("Token refresh failed:", error);
|
|
87
|
+
// On refresh failure, clear all auth-related cookies at server side
|
|
88
|
+
deleteCookie(event, ACCESS_TOKEN_KEY);
|
|
89
|
+
deleteCookie(event, REFRESH_TOKEN_KEY);
|
|
90
|
+
deleteCookie(event, EXP_TIME_KEY);
|
|
87
91
|
throw error;
|
|
88
92
|
}
|
|
89
93
|
}
|