Something went wrong. Try again.
Monorepo for Tangled tangled.org
Something went wrong. Try again.
12345678910111213141516171819202122import type { Did } from "@atcute/lexicons/syntax";import { OAuthResponseError, TokenRefreshError, deleteStoredSessionAt} from "@atcute/oauth-browser-client";
// a refresh that the pds rejected outright, the session is gone and only a new// authorization brings it back. anything else (network, 5xx) is transient.export const isDeadSessionError = (cause: unknown): boolean => cause instanceof TokenRefreshError || (cause instanceof OAuthResponseError && cause.status === 400 && (cause.error === "invalid_grant" || cause.error === "invalid_token"));
// only the stored copy the pds refused is forgotten, so a session another tab stored since// survives. a missing session names no copy, and forgets nothingexport const forgetRefusedSession = async (did: Did, cause: unknown): Promise<boolean> => cause instanceof TokenRefreshError && cause.revision !== undefined && deleteStoredSessionAt(did, cause.revision);