Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
fix: perform logout if the silent refresh attempt fails (#3705)
Dmitryd1f6f40ef863
diff --git a/packages/hoppscotch-selfhost-web/src/platform/auth/auth.platform.ts b/packages/hoppscotch-selfhost-web/src/platform/auth/auth.platform.tsindex 6783f60df..c6708bc8f 100644--- a/packages/hoppscotch-selfhost-web/src/platform/auth/auth.platform.ts+++ b/packages/hoppscotch-selfhost-web/src/platform/auth/auth.platform.ts@@ -114,6 +114,7 @@ async function setInitialUser() {} else {setUser(null)isGettingInitialUser.value = false+ await logout()}return@@ -146,22 +147,26 @@ async function setInitialUser() {}async function refreshToken() {- const res = await axios.get(- `${import.meta.env.VITE_BACKEND_API_URL}/auth/refresh`,- {- withCredentials: true,- }- )+ try {+ const res = await axios.get(+ `${import.meta.env.VITE_BACKEND_API_URL}/auth/refresh`,+ {+ withCredentials: true,+ }+ )- const isSuccessful = res.status === 200+ const isSuccessful = res.status === 200- if (isSuccessful) {- authEvents$.next({- event: "token_refresh",- })- }+ if (isSuccessful) {+ authEvents$.next({+ event: "token_refresh",+ })+ }- return isSuccessful+ return isSuccessful+ } catch (error) {+ return false+ }}async function sendMagicLink(email: string) {