withAuthenticationRequires returns user to another route after page refresh

Hi @AlperenOzturk,

Here is the documentation for onRedirectCallback: https://auth0.github.io/auth0-react/interfaces/auth0_provider.auth0provideroptions.html#onredirectcallback

By default this removes the code and state parameters from the url when you are redirected from the authorize page. It uses window.history but you might want to overwrite this if you are using a custom router, like react-router-dom

This function runs after authentication to handle the redirect callback.

You can find a full example of overriding the default behavior specifically for React Router in this article:

Here is another example that is referenced in the documentation: https://github.com/auth0/auth0-react/tree/9a15c540fee6d53514eaaea77cbadfb767b14891/examples/cra-react-router

Let me know if you have additional questions regarding onRedirectCallback. Thanks!