diff --git a/src/context/sasContext.tsx b/src/context/sasContext.tsx index 4496bd1..4b75323 100644 --- a/src/context/sasContext.tsx +++ b/src/context/sasContext.tsx @@ -138,6 +138,23 @@ const SASProvider = (props: { children: ReactNode }) => { if (!startupData) { fetchStartupData() } + } else if (sasjsConfig.loginMechanism === 'Redirected') { + sasService + .logIn() + .then( + (res: { isLoggedIn: boolean; userName: string }) => { + setIsUserLoggedIn(res.isLoggedIn) + }, + (err) => { + console.error(err) + setIsUserLoggedIn(false) + } + ) + .catch((e) => { + if (e === 403) { + console.error('Invalid host') + } + }) } }, [isUserLoggedIn, startupData, fetchStartupData]) diff --git a/src/layouts/Main.jsx b/src/layouts/Main.jsx index 9eb5b28..5c8c737 100644 --- a/src/layouts/Main.jsx +++ b/src/layouts/Main.jsx @@ -192,9 +192,11 @@ const Main = (props) => { open={open} /> - {!(sasContext.isUserLoggedIn || sasContext.checkingSession) && ( - - )} + {!( + window.sasjsConfig.loginMechanism === 'Redirected' || + sasContext.isUserLoggedIn || + sasContext.checkingSession + ) && } ) }