toeverything/AFFiNE · error · Error
Failed to revoke auth session
Error message
Failed to revoke auth session
What it means
revokeAuthSession posts the refresh token to the server's session revoke endpoint; the underlying request wrapper throws 'Failed to revoke auth session' when the server rejects the revocation, so sign-out failures surface instead of leaving a live session.
Source
Thrown at packages/frontend/apps/electron/src/main/auth/auth-session.ts:219
export async function revokeAuthSession(endpoint: string) {
const normalized = normalizeEndpoint(endpoint);
await getAuthSessionBroker(normalized).revoke(
'sign-out',
async (refreshToken: string) => {
const response = await authFetch(
new URL('/api/auth/session/revoke', normalized).toString(),
{
method: 'POST',
headers: {
'content-type': 'application/json',
'x-affine-client-kind': 'native',
'x-affine-version': BUILD_CONFIG.appVersion,
},
body: JSON.stringify({ refreshToken }),
signal: AbortSignal.timeout(AUTH_REQUEST_TIMEOUT),
}
);
if (!response.ok) throw new Error('Failed to revoke auth session');
}
);
}
export async function clearAuthSession(endpoint: string, reason: string) {
await getAuthSessionBroker(endpoint).clear(reason);
}
export async function getValidAccessToken(
endpoint: string,
minValidity = 60_000
) {
try {
return await getAuthSessionBroker(endpoint).getValidAccessToken(
minValidity
);
} catch (error) {
const classified = classifyAuthError(error);View on GitHub (pinned to b4c8548c09)
Solutions
- Retry sign-out; the revocation request to the auth server failed.
- Check network connectivity to the auth server.
- Clear the local session if the server-side session is already gone; the local state will be reset regardless.
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at packages/frontend/apps/electron/src/main/auth/auth-session.ts:219 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18).
Data as JSON: /api/errors/2adc67aacf0b62e6.
Report an issue: GitHub.