Mirror — see github.com/blacksky-algorithms/blacksky.community
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

Show OAuth-specific error messages instead of generic 'Sign in failed' toast

Adds cleanError mappings for OAuth failure modes (session deleted,
Database closed, invalid_dpop_proof iat skew, refresh exhaustion, sub
mismatch, Session resume timed out) and routes them through the existing
toast on ChooseAccountForm so users get an actionable message instead of
a raw oauth-client error string.

+31 -1
+28
src/lib/strings/errors.ts
··· 39 39 ) { 40 40 return t`This feature is not available with your current session. Please manage your account through your hosting provider's website, or sign out and sign back in to refresh your permissions.` 41 41 } 42 + if ( 43 + str.includes('session was deleted by another process') || 44 + str.includes('No refresh token available') || 45 + str.includes('The session was revoked') 46 + ) { 47 + return t`Your session has expired. Please sign in again.` 48 + } 49 + if ( 50 + str.includes('Database closed') || 51 + str.includes('Database has been disposed') 52 + ) { 53 + return t`Session storage is unavailable. Please sign in again.` 54 + } 55 + if (str.includes('invalid_dpop_proof') && str.includes('iat claim')) { 56 + return t`Your device clock appears to be incorrect. Please check your system time settings and try again.` 57 + } 58 + if (str.includes('invalid_dpop_proof')) { 59 + return t`Authentication error. Please try signing in again.` 60 + } 61 + if (str.includes('Session resume timed out')) { 62 + return t`Sign in is taking too long. Please try again.` 63 + } 64 + if ( 65 + str.includes('Token set sub mismatch') || 66 + str.includes('Stored session sub mismatch') 67 + ) { 68 + return t`Session data is corrupted. Please sign in again.` 69 + } 42 70 if (str.includes('Account has been suspended')) { 43 71 return t`Account has been suspended` 44 72 }
+3 -1
src/screens/Login/ChooseAccountForm.tsx
··· 3 3 import {msg, Trans} from '@lingui/macro' 4 4 import {useLingui} from '@lingui/react' 5 5 6 + import {cleanError} from '#/lib/strings/errors' 6 7 import {logger} from '#/logger' 7 8 import {type SessionAccount, useSession, useSessionApi} from '#/state/session' 8 9 import {useLoggedOutViewControls} from '#/state/shell/logged-out' ··· 64 65 logger.error('choose account: initSession failed', { 65 66 message: e.message, 66 67 }) 67 - Toast.show(_(msg`Sign in failed. Please try again.`)) 68 + const errMsg = cleanError(e.message || e.toString()) 69 + Toast.show(errMsg || _(msg`Sign in failed. Please try again.`)) 68 70 // Move to login form. 69 71 onSelectAccount(account) 70 72 } finally {