diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 7dc48a3..92b57f7 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -303,6 +303,17 @@ } catch { // ignore } + // navi-style: reload so /me answers 401 and the SPA shows its internal + // login screen; going to /auth/login here would silently auto-login + // through the still-alive SSO session + window.location.reload(); +} + +// the sign-in gate is rendered instead of the shell after a 401 on load +const showLogin = ref(false); + +function loginNow() { + // explicit user click starts OAuth — no silent SSO bounce on load window.location.href = "/auth/login"; } const canCreateSecret = computed(() => Boolean(form.title.trim() && parseCreateFields().length)); @@ -1109,8 +1120,12 @@ await loadSecrets(); await syncTabFromRoute(true); window.addEventListener("popstate", onPopState); - } catch { - window.location.href = "/auth/login"; + } catch (err) { + if (err?.status === 401) { + showLogin.value = true; + } else { + window.location.href = "/auth/login"; + } } }); @@ -1179,7 +1194,18 @@