diff --git a/lib/identity-search/identity-search-context.js b/lib/identity-search/identity-search-context.js --- a/lib/identity-search/identity-search-context.js +++ b/lib/identity-search/identity-search-context.js @@ -4,6 +4,7 @@ import * as React from 'react'; import uuid from 'uuid'; +import { useInvalidCSATLogOut } from '../actions/user-actions.js'; import { identitySearchURL } from '../facts/identity-search.js'; import { clientRequestVisualTimeout, @@ -64,6 +65,7 @@ const [connected, setConnected] = React.useState(false); const listeners = React.useRef>(new Set()); const getIdentitySearchAuthMessage = useGetIdentitySearchAuthMessage(); + const invalidTokenLogOut = useInvalidCSATLogOut(); const [identitySearchAuthMessage, setIdentitySearchAuthMessage] = React.useState(null); const socket = React.useRef(null); @@ -170,6 +172,10 @@ 'Success for already connected socket', ); } else { + if (message.status.data?.includes('UnauthorizedDevice')) { + void invalidTokenLogOut(); + return; + } setConnected(false); console.log( 'creating session with Identity Search error:', @@ -207,6 +213,7 @@ identitySearchAuthMessage, resetHeartbeatTimeout, stopHeartbeatTimeout, + invalidTokenLogOut, ]); const sendPrefixQuery: (