Constant redirect to Okta login page, instead of custom login page

Hi my app is a react.js/Express app. And I have a custom login page that I use to log the user in.

At some point the app started redirecting to the Okta login page instead of using my login page. Does anybody know what could be causing the redirects? I have tried setting the "Initiate login URI " and some other fields with out any effect so far. Would appreciate any help.

Here is what my settings for Login look like:

Here is some of the log in code (okta-auth-js):

  try {
    const transaction = await this.oktaAuth.signIn({username, password})
    if (transaction.status === 'SUCCESS') {
      // Perform a call to mongo DB
      this.props.loginAction(transaction)
      // Do I need to call "this.oktaAuth.session.setCookieAndRedirect(transaction.sessionToken);" like the example in  (okta-auth-js)?  The tutorial I followed didn't do this. (https://scotch.io/tutorials/add-user-registration-to-your-site-with-node-react-and-okta)

    } else {
      // error logging here
    }
  } catch (err) {
    // set error in redux error reducer
    this.props.setErrorAction({
      code: err.statusCode || 'Generic authentication error',
      message: err.message || 'Generic authentication error'
    })

    // Can't get proper error messages from the response, "Authentication error" returns for everything .. :(
  }
}
1 Like

I found out what was causing the redirects. I use react-persist in my app which persists reducer state to local storage, and I wasn’t clearing the user reducer on logout yet. This seemed to be causing some issues. As soon as I started clearing that reducer on logout events the problem went away.

Hi, I am new to react native and i want to integrate okta to my react native app also i need a custom login screen so that user directly sigin from the same page with out redirecting to okta site. can i use okta-sign-widget for it…Tony have u ised react-native for developing ur app with okta,can any one tell me how to do it using react native

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