Merge remote-tracking branch 'origin/v2/main' into v2/1549-oauth-storage-no-zustand
# Conflicts: # core/auth/store.ts
This commit is contained in:
commit
edc7dbb1c1
2 changed files with 785 additions and 14 deletions
|
|
@ -8,7 +8,10 @@ import type {
|
|||
OAuthTokens,
|
||||
OAuthMetadata,
|
||||
} from "@modelcontextprotocol/sdk/shared/auth.js";
|
||||
import type { IdpSessionState, OAuthClientRegistrationKind } from "./storage.js";
|
||||
import type {
|
||||
IdpSessionState,
|
||||
OAuthClientRegistrationKind,
|
||||
} from "./storage.js";
|
||||
import type { OAuthPersistSnapshot } from "./oauth-persist.js";
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -40,9 +40,17 @@ export function useEmaIdpLoginState(
|
|||
|
||||
const logout = useCallback(() => {
|
||||
if (!normalizedIssuer) return;
|
||||
void clearEmaIdpSession(storage, normalizedIssuer).then(() => {
|
||||
setLoginState("none");
|
||||
});
|
||||
void clearEmaIdpSession(storage, normalizedIssuer)
|
||||
.then(() => {
|
||||
setLoginState("none");
|
||||
})
|
||||
.catch(() => {
|
||||
// Clearing the persisted IdP session failed (e.g. the storage backend
|
||||
// is unreachable). Swallow the rejection so it does not surface as an
|
||||
// unhandled promise, and leave loginState unchanged so the UI keeps
|
||||
// reflecting the still-present session rather than falsely showing
|
||||
// signed-out.
|
||||
});
|
||||
}, [storage, normalizedIssuer]);
|
||||
|
||||
return { loginState, refresh, logout };
|
||||
|
|
|
|||
Loading…
Reference in a new issue