Okta sign-in- Getting into an infinite redirect loop

Hey, we’re building an app that uses okta, both for registration and for logins.
github: github.com/AiaRup/triplan

From the behavior we see when we do login we are returned to the last address we visited in the app before the login. The problem is that we also have a route that is unsecured for registering a new user, so if we click on it (without registering) and go to login component that has the widget-sign in and complete the sign in process, we go back to the register component and entering into an endless loop because at this moment there is no longer a component for registration. it’s trying to go back to: localhost:3000/Register.
(other urls on app working and redirecting and sign-in working as well)

we would like to do something like this: that the redirection after sign-in will be always to localhost:3000/Home.
is it possible?

we followed this guide for the sign-in: developer.okta.com/code/react/okta_react_sign-in_widget

in App component:
return (

client_id=“my client id here”
redirect_uri={window.location.origin + ‘/implicit/callback’}

<SecureRoute exact path="/Home" render={() => } />
<SecureRoute exact path="/MyTrips" render={() => } />

render={() => ()} />

  </Router >

on the widget we tried:
class SignInWidget extends Component {
componentDidMount() {
const el = ReactDOM.findDOMNode(this);
this.widget = new OktaSignIn({
baseUrl: this.props.baseUrl,
redirectUri: ‘localhost:3000/Home’,
logo: ‘//logo.clearbit.com/okta.com’,
features: {
registration: true
registration: {
click: function () {
window.location.href = ‘localhost:3000/Register’;
this.widget.renderEl({ el }, this.props.onSuccess, this.props.onError);

we also added the address ‘ocalhost:3000’/Home’ to the App settings: Login redirect URIs .

please, any help will be appreciated!
thank you!

1 Like