fix(desktop): a failed native refresh only confirms reauth on a dead refresh token
mintGatewayWsTicket swallowed every forced-refresh failure into null, so a 5xx or timeout from /auth/native/refresh re-threw the original bearer 401 and latched the boot as "session expired" while the refresh token was still stored. Let a transport failure propagate: ensureNativeAccessToken already returns null (and drops the tokens) on a 401, which is the only refresh outcome that confirms the rejection.
This commit is contained in:
@@ -8325,7 +8325,11 @@ async function mintGatewayWsTicket(baseUrl, headers = {}) {
|
||||
throw error
|
||||
}
|
||||
|
||||
const rotatedAt = await ensureNativeAccessToken(baseUrl, { forceRefresh: true }).catch(() => null)
|
||||
// A dead refresh token returns null (tokens dropped) and the original
|
||||
// 401 stands. A refresh that could not be evaluated at all (5xx,
|
||||
// timeout, ECONNRESET) is a transport blip, not a verdict on the
|
||||
// session — let it propagate so the boot stays retryable.
|
||||
const rotatedAt = await ensureNativeAccessToken(baseUrl, { forceRefresh: true })
|
||||
|
||||
if (!rotatedAt || rotatedAt === nativeAt) {
|
||||
throw error
|
||||
|
||||
Reference in New Issue
Block a user