diff --git a/lib/components/keyserver-connection-handler.js b/lib/components/keyserver-connection-handler.js --- a/lib/components/keyserver-connection-handler.js +++ b/lib/components/keyserver-connection-handler.js @@ -35,7 +35,10 @@ import { getConfig } from '../utils/config.js'; import { useDispatchActionPromise } from '../utils/redux-promise-utils.js'; import { useSelector } from '../utils/redux-utils.js'; -import { usingCommServicesAccessToken } from '../utils/services-utils.js'; +import { + usingCommServicesAccessToken, + relyingOnAuthoritativeKeyserver, +} from '../utils/services-utils.js'; import sleep from '../utils/sleep.js'; type Props = { @@ -84,10 +87,14 @@ }, [calendarFilters, keyserverID, navInfo.endDate, navInfo.startDate]); React.useEffect(() => { - if (hasConnectionIssue && !usingCommServicesAccessToken) { + if ( + hasConnectionIssue && + keyserverID === authoritativeKeyserverID && + relyingOnAuthoritativeKeyserver + ) { void dispatchActionPromise(logOutActionTypes, callLogOut()); } - }, [callLogOut, hasConnectionIssue, dispatchActionPromise]); + }, [callLogOut, hasConnectionIssue, dispatchActionPromise, keyserverID]); const identityContext = React.useContext(IdentityClientContext); invariant(identityContext, 'Identity context should be set'); @@ -170,7 +177,11 @@ e, ); - if (!dataLoaded && keyserverID === authoritativeKeyserverID()) { + if ( + !dataLoaded && + keyserverID === authoritativeKeyserverID() && + relyingOnAuthoritativeKeyserver + ) { await dispatchActionPromise(logOutActionTypes, callLogOut()); } } finally { diff --git a/lib/utils/services-utils.js b/lib/utils/services-utils.js --- a/lib/utils/services-utils.js +++ b/lib/utils/services-utils.js @@ -4,8 +4,15 @@ import type { AuthMetadata } from '../shared/identity-client-context.js'; +// If this is true then we're using the identity service for auth. After we +// auth, the identity service gives us a CSAT, which we can use to auth with +// other Comm services. const usingCommServicesAccessToken = false; +// If this is false, then the app no longer needs to rely on being connected to +// an authoritative keyserver for things like DMs. +const relyingOnAuthoritativeKeyserver = true; + function handleHTTPResponseError(response: Response): void { if (!response.ok) { const { status, statusText } = response; @@ -33,6 +40,7 @@ export { handleHTTPResponseError, usingCommServicesAccessToken, + relyingOnAuthoritativeKeyserver, createHTTPAuthorizationHeader, createDefaultHTTPRequestHeaders, };