Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(desktop-app-r7-h1): confirm cross-environment logout

Josué561bf0f779c5
diff --git a/desktop-app/ui/src/App.tsx b/desktop-app/ui/src/App.tsx
index c3b572125..adc16c5f5 100644
--- a/desktop-app/ui/src/App.tsx
+++ b/desktop-app/ui/src/App.tsx
@@ -2707,6 +2707,51 @@ export function App() {
}
})()
: ''
+ const pendingSwitchTargetHost = vm.pendingDesktopEnvironmentSwitchConfirmation
+ ? (() => {
+ try {
+ return new URL(
+ vm.pendingDesktopEnvironmentSwitchConfirmation.targetExternalRestApiBaseUrl
+ ).host
+ } catch {
+ return vm.pendingDesktopEnvironmentSwitchConfirmation.targetExternalRestApiBaseUrl
+ }
+ })()
+ : ''
+ const environmentSwitchConfirmationDialog = vm.pendingDesktopEnvironmentSwitchConfirmation ? (
+ <ConfirmDialog
+ title="Switch desktop environment?"
+ body={
+ <>
+ <p>
+ You are signed in to{' '}
+ <strong>{vm.pendingDesktopEnvironmentSwitchConfirmation.activeEnvironmentName}</strong>.
+ Switching to{' '}
+ <strong>{vm.pendingDesktopEnvironmentSwitchConfirmation.targetEnvironmentName}</strong>{' '}
+ will sign you out and interrupt activity in the current environment.
+ </p>
+ {vm.pendingDesktopEnvironmentSwitchConfirmation.activeExternalRestApiBaseUrl ? (
+ <p className="auth-environment-confirm-url">
+ Current REST API:{' '}
+ {vm.pendingDesktopEnvironmentSwitchConfirmation.activeExternalRestApiBaseUrl}
+ </p>
+ ) : null}
+ <p>Continue only if you trust this External REST API host:</p>
+ <p className="auth-environment-confirm-url">
+ {vm.pendingDesktopEnvironmentSwitchConfirmation.targetExternalRestApiBaseUrl}
+ </p>
+ {pendingSwitchTargetHost ? (
+ <p className="muted">Host: {pendingSwitchTargetHost}</p>
+ ) : null}
+ </>
+ }
+ cancelLabel="Stay signed in"
+ confirmLabel="Sign out and switch"
+ onCancel={vm.handleCancelDesktopEnvironmentSwitchConfirmation}
+ onConfirm={vm.handleConfirmDesktopEnvironmentSwitchConfirmation}
+ tone="danger"
+ />
+ ) : null
const environmentSetupConfirmationDialog = vm.pendingDesktopEnvironmentSetup ? (
<ConfirmDialog
title="Add desktop environment?"
@@ -3015,6 +3060,7 @@ export function App() {
) : null}
{desktopUpdateRequiredDialog}
{environmentSetupConfirmationDialog}
+ {environmentSwitchConfirmationDialog}
{environmentSetupSuccessDialog}
{sandboxUiDeepLinkDialog}
{pluginConsentPrompt ? (
@@ -3051,6 +3097,7 @@ export function App() {
<AuthPage />
)}
{environmentSetupConfirmationDialog}
+ {environmentSwitchConfirmationDialog}
{environmentSetupSuccessDialog}
<ToastStack items={vm.toasts} />
</>
diff --git a/desktop-app/ui/src/hooks/domain/__tests__/desktopEnvironmentHandoff.test.ts b/desktop-app/ui/src/hooks/domain/__tests__/desktopEnvironmentHandoff.test.ts
index 05f9e3073..2419447b4 100644
--- a/desktop-app/ui/src/hooks/domain/__tests__/desktopEnvironmentHandoff.test.ts
+++ b/desktop-app/ui/src/hooks/domain/__tests__/desktopEnvironmentHandoff.test.ts
@@ -65,7 +65,13 @@ function createHandler(
> = async () => runtimeConfigModule!.getDesktopRuntimeConfigState(),
logoutForEnvironmentMismatch?: () => Promise<number | null>,
onSessionNeedsLoad: () => Promise<void> = vi.fn(async () => {}),
- readSessionGeneration?: () => Promise<number>
+ readSessionGeneration?: () => Promise<number>,
+ requestEnvironmentSwitchConfirmation: (details: {
+ activeEnvironmentName: string
+ activeExternalRestApiBaseUrl: string
+ targetEnvironmentName: string
+ targetExternalRestApiBaseUrl: string
+ }) => Promise<boolean> = vi.fn(async () => true)
) {
let sessionGeneration = 0
const getSessionGeneration = readSessionGeneration ?? (async () => sessionGeneration)
@@ -92,12 +98,15 @@ function createHandler(
handleSelectRuntimeConfig: selectRuntimeConfig,
onSessionNeedsLoad,
logoutForEnvironmentMismatch: logout,
+ requestEnvironmentSwitchConfirmation,
setPendingDesktopEnvironmentSetup,
setStatus,
})
return {
handler,
onSessionNeedsLoad,
+ logout,
+ requestEnvironmentSwitchConfirmation,
selectRuntimeConfig,
setPendingDesktopEnvironmentSetup,
setStatus,
@@ -217,6 +226,39 @@ describe('Desktop environment handoff concurrency', () => {
}
})
+ it('asks before logging out to switch from an authenticated environment', async () => {
+ const requestEnvironmentSwitchConfirmation = vi.fn(async () => false)
+ const {
+ handler,
+ logout,
+ requestEnvironmentSwitchConfirmation: requestConfirmation,
+ selectRuntimeConfig,
+ setPendingDesktopEnvironmentSetup,
+ } = createHandler(
+ () => ({ booting: false, busy: false, authTransitioning: false, isAuthenticated: true }),
+ undefined,
+ undefined,
+ undefined,
+ undefined,
+ requestEnvironmentSwitchConfirmation
+ )
+
+ await handler({
+ ...targetEnvironment,
+ externalRestApiBaseUrl: `${targetEnvironment.externalRestApiBaseUrl}/api/v1`,
+ })
+
+ expect(requestConfirmation).toHaveBeenCalledWith({
+ activeEnvironmentName: 'Current tenant',
+ activeExternalRestApiBaseUrl: currentEnvironment.externalRestApiBaseUrl,
+ targetEnvironmentName: targetEnvironment.appName,
+ targetExternalRestApiBaseUrl: `${targetEnvironment.externalRestApiBaseUrl}/api/v1`,
+ })
+ expect(logout).not.toHaveBeenCalled()
+ expect(selectRuntimeConfig).not.toHaveBeenCalled()
+ expect(setPendingDesktopEnvironmentSetup).not.toHaveBeenCalled()
+ })
+
it('keeps the current environment when token removal fails during handoff logout', async () => {
let rendererAuthenticated = true
const clearSessionToken = vi.fn(async () => {
diff --git a/desktop-app/ui/src/hooks/domain/__tests__/useAuthController.desktopEnvironment.test.tsx b/desktop-app/ui/src/hooks/domain/__tests__/useAuthController.desktopEnvironment.test.tsx
index b73a9810d..805bb303c 100644
--- a/desktop-app/ui/src/hooks/domain/__tests__/useAuthController.desktopEnvironment.test.tsx
+++ b/desktop-app/ui/src/hooks/domain/__tests__/useAuthController.desktopEnvironment.test.tsx
@@ -47,6 +47,8 @@ let desktopEnvironmentSetupListener:
| ((payload: DesktopEnvironmentSetupPayload) => void | Promise<void>)
| null = null
let confirmDesktopEnvironmentSetupForTest: (() => Promise<void>) | null = null
+let confirmDesktopEnvironmentSwitchForTest: (() => void) | null = null
+let cancelDesktopEnvironmentSwitchForTest: (() => void) | null = null
let setBootingForTest: ((value: boolean) => void) | null = null
let setAuthenticatedForTest: ((value: boolean) => void) | null = null
let runtimeConfigModule: typeof import('../../../../../src/config') | null = null
@@ -63,6 +65,8 @@ function Probe() {
setBootingForTest = auth.setBooting
setAuthenticatedForTest = auth.setIsAuthenticated
confirmDesktopEnvironmentSetupForTest = auth.handleConfirmDesktopEnvironmentSetup
+ confirmDesktopEnvironmentSwitchForTest = auth.handleConfirmDesktopEnvironmentSwitchConfirmation
+ cancelDesktopEnvironmentSwitchForTest = auth.handleCancelDesktopEnvironmentSwitchConfirmation
return (
<>
@@ -70,6 +74,10 @@ function Probe() {
<div data-testid="pending-environment">
{auth.pendingDesktopEnvironmentSetup?.externalRestApiBaseUrl || 'none'}
</div>
+ <div data-testid="pending-environment-switch">
+ {auth.pendingDesktopEnvironmentSwitchConfirmation?.targetExternalRestApiBaseUrl || 'none'}
+ </div>
+ <div data-testid="is-authenticated">{auth.isAuthenticated ? 'yes' : 'no'}</div>
<div data-testid="pending-rpc">
{auth.pendingDesktopEnvironmentSetup?.rpcProxyBaseUrl || 'none'}
</div>
@@ -102,6 +110,8 @@ beforeEach(async () => {
vi.clearAllMocks()
desktopEnvironmentSetupListener = null
confirmDesktopEnvironmentSetupForTest = null
+ confirmDesktopEnvironmentSwitchForTest = null
+ cancelDesktopEnvironmentSwitchForTest = null
setBootingForTest = null
setAuthenticatedForTest = null
runtimeConfigModule = null
@@ -473,7 +483,73 @@ describe('Desktop environment handoff', () => {
expect(screen.getByTestId('pending-rpc')).toHaveTextContent('none')
})
- it('logs out and selects the linked saved environment when REST endpoints differ', async () => {
+ it('keeps the current session when the user cancels a REST environment switch', async () => {
+ render(<Probe />)
+ await waitFor(() => expect(screen.getByTestId('configuration-loaded')).toHaveTextContent('yes'))
+ await act(async () => setAuthenticatedForTest?.(true))
+ mocks.logoutForEnvironmentMismatch.mockClear()
+ mocks.clearQueryCache.mockClear()
+
+ let handoff!: Promise<void>
+ await act(async () => {
+ handoff = Promise.resolve(
+ desktopEnvironmentSetupListener!({
+ ...targetEnvironment,
+ externalRestApiBaseUrl: `${targetEnvironment.externalRestApiBaseUrl}/api/v1`,
+ })
+ )
+ })
+ await waitFor(() =>
+ expect(screen.getByTestId('pending-environment-switch')).toHaveTextContent(
+ `${targetEnvironment.externalRestApiBaseUrl}/api/v1`
+ )
+ )
+
+ expect(mocks.logoutForEnvironmentMismatch).not.toHaveBeenCalled()
+ expect(mocks.clearQueryCache).not.toHaveBeenCalled()
+ expect(screen.getByTestId('pending-environment')).toHaveTextContent('none')
+
+ await act(async () => cancelDesktopEnvironmentSwitchForTest?.())
+ await act(async () => handoff)
+
+ expect(mocks.logoutForEnvironmentMismatch).not.toHaveBeenCalled()
+ expect(mocks.selectRuntimeConfigForHandoff).not.toHaveBeenCalled()
+ expect(mocks.clearQueryCache).not.toHaveBeenCalled()
+ expect(screen.getByTestId('is-authenticated')).toHaveTextContent('yes')
+ expect(screen.getByTestId('pending-environment-switch')).toHaveTextContent('none')
+ })
+
+ it('does not log out a newer session after the switch confirmation is open', async () => {
+ render(<Probe />)
+ await waitFor(() => expect(screen.getByTestId('configuration-loaded')).toHaveTextContent('yes'))
+ await act(async () => setAuthenticatedForTest?.(true))
+ mocks.logoutForEnvironmentMismatch.mockClear()
+
+ let handoff!: Promise<void>
+ await act(async () => {
+ handoff = Promise.resolve(
+ desktopEnvironmentSetupListener!({
+ ...targetEnvironment,
+ externalRestApiBaseUrl: `${targetEnvironment.externalRestApiBaseUrl}/api/v1`,
+ })
+ )
+ })
+ await waitFor(() =>
+ expect(screen.getByTestId('pending-environment-switch')).toHaveTextContent(
+ `${targetEnvironment.externalRestApiBaseUrl}/api/v1`
+ )
+ )
+
+ nativeSessionGeneration += 1
+ await act(async () => confirmDesktopEnvironmentSwitchForTest?.())
+ await act(async () => handoff)
+
+ expect(mocks.logoutForEnvironmentMismatch).not.toHaveBeenCalled()
+ expect(mocks.selectRuntimeConfigForHandoff).not.toHaveBeenCalled()
+ expect(screen.getByTestId('pending-environment')).toHaveTextContent('none')
+ })
+
+ it('logs out and selects the linked saved environment after switch confirmation', async () => {
const state = await runtimeConfigModule!.getDesktopRuntimeConfigState()
const otherOption = state.options.find(
option => option.externalRestApiBaseUrl === otherEnvironment.externalRestApiBaseUrl
@@ -487,10 +563,23 @@ describe('Desktop environment handoff', () => {
mocks.selectRuntimeConfig.mockClear()
mocks.setStatus.mockClear()
- await dispatchDesktopEnvironmentLink({
- ...targetEnvironment,
- externalRestApiBaseUrl: `${targetEnvironment.externalRestApiBaseUrl}/api/v1`,
+ let handoff!: Promise<void>
+ await act(async () => {
+ handoff = Promise.resolve(
+ desktopEnvironmentSetupListener!({
+ ...targetEnvironment,
+ externalRestApiBaseUrl: `${targetEnvironment.externalRestApiBaseUrl}/api/v1`,
+ })
+ )
})
+ await waitFor(() =>
+ expect(screen.getByTestId('pending-environment-switch')).toHaveTextContent(
+ `${targetEnvironment.externalRestApiBaseUrl}/api/v1`
+ )
+ )
+ expect(mocks.logoutForEnvironmentMismatch).not.toHaveBeenCalled()
+ await act(async () => confirmDesktopEnvironmentSwitchForTest?.())
+ await act(async () => handoff)
expect(mocks.logoutForEnvironmentMismatch).toHaveBeenCalledOnce()
expect(mocks.selectRuntimeConfigForHandoff).toHaveBeenCalledWith(await savedTargetOptionId(), 1)
diff --git a/desktop-app/ui/src/hooks/domain/desktopEnvironmentHandoff.ts b/desktop-app/ui/src/hooks/domain/desktopEnvironmentHandoff.ts
index 136789c9e..4a3cb9d4b 100644
--- a/desktop-app/ui/src/hooks/domain/desktopEnvironmentHandoff.ts
+++ b/desktop-app/ui/src/hooks/domain/desktopEnvironmentHandoff.ts
@@ -8,7 +8,7 @@ import type {
DesktopRuntimeConfigHandoffSelection,
DesktopRuntimeConfigState,
} from '../../../../src/types'
-import type { SetStatusFn } from './types'
+import type { DesktopEnvironmentSwitchConfirmation, SetStatusFn } from './types'
const LOCALHOST_OPTION_ID = '__localhost__'
@@ -33,6 +33,9 @@ type DesktopEnvironmentSetupHandlerOptions = {
expectedSessionGeneration: number
) => Promise<DesktopRuntimeConfigHandoffSelection | null>
onSessionNeedsLoad: (options?: { preserveNav?: boolean }) => Promise<void>
+ requestEnvironmentSwitchConfirmation: (
+ details: DesktopEnvironmentSwitchConfirmation
+ ) => Promise<boolean>
logoutForEnvironmentMismatch: () => Promise<number | null>
setPendingDesktopEnvironmentSetup: (config: DesktopRuntimeConfig | null) => void
setStatus: SetStatusFn
@@ -80,6 +83,7 @@ export function createDesktopEnvironmentSetupHandler({
refreshRuntimeConfigState,
handleSelectRuntimeConfig,
onSessionNeedsLoad,
+ requestEnvironmentSwitchConfirmation,
logoutForEnvironmentMismatch,
setPendingDesktopEnvironmentSetup,
setStatus,
@@ -166,6 +170,18 @@ export function createDesktopEnvironmentSetupHandler({
)
)
if (authState.isAuthenticated && !activeRestEndpointMatches) {
+ const switchConfirmed = await requestEnvironmentSwitchConfirmation({
+ activeEnvironmentName: configState.currentConfig?.appName?.trim() || 'Current environment',
+ activeExternalRestApiBaseUrl: configState.currentConfig?.externalRestApiBaseUrl || '',
+ targetEnvironmentName: linkedConfig.appName || 'Evenfire',
+ targetExternalRestApiBaseUrl: linkedConfig.externalRestApiBaseUrl,
+ })
+ if (!switchConfirmed) return
+ if (!(await ownsSessionGeneration(sessionGeneration))) return
+
+ authState = getAuthState()
+ if (isAuthenticationOperationInProgress(authState) || !authState.isAuthenticated) return
+
setPendingDesktopEnvironmentSetup(null)
let logoutGeneration: number | null
try {
diff --git a/desktop-app/ui/src/hooks/domain/types.ts b/desktop-app/ui/src/hooks/domain/types.ts
index 2124f877d..3d568ad27 100644
--- a/desktop-app/ui/src/hooks/domain/types.ts
+++ b/desktop-app/ui/src/hooks/domain/types.ts
@@ -9,6 +9,13 @@ export type SetStatusFn = (
export type PushToastFn = (message: string, tone: Tone, options?: { durationMs?: number }) => void
+export type DesktopEnvironmentSwitchConfirmation = {
+ activeEnvironmentName: string
+ activeExternalRestApiBaseUrl: string
+ targetEnvironmentName: string
+ targetExternalRestApiBaseUrl: string
+}
+
export type PushNotificationInput = Omit<AppNotification, 'id' | 'read' | 'timestamp'> & {
dedupeKey?: string
timestamp?: number
diff --git a/desktop-app/ui/src/hooks/domain/useAuthController.ts b/desktop-app/ui/src/hooks/domain/useAuthController.ts
index f7c7c8723..a67ce5d6b 100644
--- a/desktop-app/ui/src/hooks/domain/useAuthController.ts
+++ b/desktop-app/ui/src/hooks/domain/useAuthController.ts
@@ -15,7 +15,7 @@ import {
createDesktopEnvironmentSetupHandler,
getDesktopEnvironmentRestMatches,
} from './desktopEnvironmentHandoff'
-import type { SetStatusFn } from './types'
+import type { DesktopEnvironmentSwitchConfirmation, SetStatusFn } from './types'
interface UseAuthControllerParams {
setStatus: SetStatusFn
@@ -94,6 +94,30 @@ export function useAuthController({
const [desktopEnvironmentSetupComplete, setDesktopEnvironmentSetupComplete] = useState(false)
const [pendingDesktopEnvironmentSetup, setPendingDesktopEnvironmentSetup] =
useState<DesktopRuntimeConfig | null>(null)
+ const [
+ pendingDesktopEnvironmentSwitchConfirmation,
+ setPendingDesktopEnvironmentSwitchConfirmation,
+ ] = useState<DesktopEnvironmentSwitchConfirmation | null>(null)
+ const desktopEnvironmentSwitchConfirmationResolver = useRef<
+ ((confirmed: boolean) => void) | null
+ >(null)
+
+ const requestEnvironmentSwitchConfirmation = useCallback(
+ (details: DesktopEnvironmentSwitchConfirmation) =>
+ new Promise<boolean>(resolve => {
+ desktopEnvironmentSwitchConfirmationResolver.current?.(false)
+ desktopEnvironmentSwitchConfirmationResolver.current = resolve
+ setPendingDesktopEnvironmentSwitchConfirmation(details)
+ }),
+ []
+ )
+
+ const resolveEnvironmentSwitchConfirmation = useCallback((confirmed: boolean) => {
+ const resolve = desktopEnvironmentSwitchConfirmationResolver.current
+ desktopEnvironmentSwitchConfirmationResolver.current = null
+ setPendingDesktopEnvironmentSwitchConfirmation(null)
+ resolve?.(confirmed)
+ }, [])
const runtimeConfigMissing = Boolean(runtimeConfigState && !runtimeConfigState.configured)
const showRuntimeConfigSelector = Boolean(
@@ -415,18 +439,26 @@ export function useAuthController({
)
useEffect(() => {
- return window.clerum.auth.onDesktopEnvironmentSetup(
+ const unsubscribe = window.clerum.auth.onDesktopEnvironmentSetup(
createDesktopEnvironmentSetupHandler({
getAuthState: getDesktopEnvironmentHandoffAuthState,
getSessionGeneration,
refreshRuntimeConfigState,
handleSelectRuntimeConfig: handleSelectRuntimeConfigForHandoff,
onSessionNeedsLoad,
+ requestEnvironmentSwitchConfirmation,
logoutForEnvironmentMismatch,
setPendingDesktopEnvironmentSetup,
setStatus,
})
)
+ return () => {
+ unsubscribe()
+ const resolve = desktopEnvironmentSwitchConfirmationResolver.current
+ desktopEnvironmentSwitchConfirmationResolver.current = null
+ setPendingDesktopEnvironmentSwitchConfirmation(null)
+ resolve?.(false)
+ }
}, [
getDesktopEnvironmentHandoffAuthState,
getSessionGeneration,
@@ -434,6 +466,7 @@ export function useAuthController({
handleSelectRuntimeConfigForHandoff,
logoutForEnvironmentMismatch,
onSessionNeedsLoad,
+ requestEnvironmentSwitchConfirmation,
refreshRuntimeConfigState,
setStatus,
])
@@ -467,6 +500,23 @@ export function useAuthController({
})
}
+ const handleCancelDesktopEnvironmentSwitchConfirmation = useCallback(() => {
+ resolveEnvironmentSwitchConfirmation(false)
+ setStatus(
+ 'Environment switch cancelled. Your current session remains active.',
+ 'info',
+ undefined,
+ {
+ global: false,
+ toast: true,
+ }
+ )
+ }, [resolveEnvironmentSwitchConfirmation, setStatus])
+
+ const handleConfirmDesktopEnvironmentSwitchConfirmation = useCallback(() => {
+ resolveEnvironmentSwitchConfirmation(true)
+ }, [resolveEnvironmentSwitchConfirmation])
+
const handleConfirmDesktopEnvironmentSetup = async (): Promise<void> => {
const nextConfig = pendingDesktopEnvironmentSetup
if (!nextConfig) return
@@ -577,6 +627,7 @@ export function useAuthController({
desktopReleaseStatus,
desktopEnvironmentSetupComplete,
pendingDesktopEnvironmentSetup,
+ pendingDesktopEnvironmentSwitchConfirmation,
backendSwitchHint,
runtimeConfigMissing,
showRuntimeConfigSelector,
@@ -610,6 +661,8 @@ export function useAuthController({
handleClearRuntimeConfigSelection,
handleCancelDesktopEnvironmentSetup,
handleConfirmDesktopEnvironmentSetup,
+ handleCancelDesktopEnvironmentSwitchConfirmation,
+ handleConfirmDesktopEnvironmentSwitchConfirmation,
refreshDesktopReleaseStatus,
handleOpenDesktopRelease,
}
diff --git a/desktop-app/ui/src/hooks/useAppController.ts b/desktop-app/ui/src/hooks/useAppController.ts
index c1a331441..bf9994661 100644
--- a/desktop-app/ui/src/hooks/useAppController.ts
+++ b/desktop-app/ui/src/hooks/useAppController.ts
@@ -1445,6 +1445,7 @@ export function useAppController() {
desktopReleaseStatus: auth.desktopReleaseStatus,
desktopEnvironmentSetupComplete: auth.desktopEnvironmentSetupComplete,
pendingDesktopEnvironmentSetup: auth.pendingDesktopEnvironmentSetup,
+ pendingDesktopEnvironmentSwitchConfirmation: auth.pendingDesktopEnvironmentSwitchConfirmation,
backendSwitchHint: auth.backendSwitchHint,
showRuntimeConfigSelector: auth.showRuntimeConfigSelector,
dependencyHealth: auth.dependencyHealth,
@@ -1469,6 +1470,10 @@ export function useAppController() {
handleClearRuntimeConfigSelection: auth.handleClearRuntimeConfigSelection,
handleCancelDesktopEnvironmentSetup: auth.handleCancelDesktopEnvironmentSetup,
handleConfirmDesktopEnvironmentSetup: auth.handleConfirmDesktopEnvironmentSetup,
+ handleCancelDesktopEnvironmentSwitchConfirmation:
+ auth.handleCancelDesktopEnvironmentSwitchConfirmation,
+ handleConfirmDesktopEnvironmentSwitchConfirmation:
+ auth.handleConfirmDesktopEnvironmentSwitchConfirmation,
handleOpenDesktopRelease: auth.handleOpenDesktopRelease,
setDesktopEnvironmentSetupComplete: auth.setDesktopEnvironmentSetupComplete,
handleLogout,