<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D51Y00009hN7dJSASOkta Classic EngineSingle Sign-OnAnswered2024-04-30T09:14:01.000Z2020-10-17T09:32:57.000Z2020-10-22T23:55:33.000Z

wi87i (wi87i) asked a question.

OnAuthRequired doesn't redirect to custom login page

Ok, so I have this weird problem. I want my app to redirect to /login so it would show (redirect to) my custom login component when user is not logged in and tries to access '/' page. However when I go to that page while not being logged in it won't redirect me to that page and goes straight to default okta login page. Here's my code:

 

  export const App = () => { 

   const history = useHistory();

   const onAuthRequired = ({history}) => {

    history.push('/login');

   };

 

...

 

  <Security {...config} onAuthRequired={onAuthRequired}>

   <Switch>

   <Route path={CALLBACK_PATH} component={LoginCallback} />

    <Route exact path="/login" component={() => <ScreensLogin issuer={config.issuer} />}/>

    <Route exact path="/signup" component={ScreensSignup} />

    <ScreensMain>

    <SecureRoute exact path="/" component={() => <ScreensDesktop />} />

    <SecureRoute exact path="/groups" component={() => <ScreensGroups />} />

    <SecureRoute exact path="/sensors" component={() => <ScreensSensors />} />

    <SecureRoute exact path="/contact" component={() => <ScreensContact />} />

    </ScreensMain>

   </Switch>

   </Security>


  • fu1ko (fu1ko)

    Hello Adam,

     

    Could you please provide a screenshot of your customization setting?

     

    Regards,

     

    Expand Post
This question is closed.
Loading
OnAuthRequired doesn't redirect to custom login page