Although OnAuthRequired is set it still redirects me to okta login

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>

@adammo Regarding to your descritipion, I am not sure how your configure your app and how this issue is reproduced. Can you please open a support ticket through an email to support@okta.com with this issue. One of our Developer Support Engineers will take the case and assist you in narrowing down the cause of the issue.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.