Public route outside Auth0Provider

I’m using Auth0 react and followed this tutorial. All is working fine but I need to create a public route so I made it to something like this:

ReactDOM.render(
  <React.StrictMode>
    <Router>
    <Route exact path="/publicpage"  component={PublicComponent} ></Route>
      <Auth0ProviderWithHistory>
        <App />
      </Auth0ProviderWithHistory>            
    </Router>
  </React.StrictMode>,
  document.getElementById('root')
);

Whenever I try to navigate to that route, the browser will load the component however, it will automatically redirect to the login page since I’m not yet authenticated. If I remove the Auth0ProviderWithHistory encapsulation, I am able to navigate to the page properly. Anything that I need to do to fix this behaviour?

Thanks

1 Like