I just spent WAY to long figuring this out.
Basically, I have a custom auth setup with some private routes in the router.
The private routes were not letting me through even though isAuthenticated returned true.
The fix was adding the useAuth prop into the Router. So:
<Router useAuth={useAuth}>
Without the useAuth prop, it will not let an authenticated user into the private routes.
This is not shown in the reference on the Router Private Set.
I see that it is included in the tutorial though.
Hope this saves someone hours.
Tobbe
2
How did you initially setup auth? The useAuth
prop should be automatically added to the <Router>
component by the auth setup command.
It’s an old repo with a new auth setup. I also upgraded from version 5-8.
I guess I deleted the <Router useAuth={useAuth} at some point. I found the change going through my diff.
I kept going back to that private set doc looking for it but couldn’t see it. Now looking through the docs I see it everywhere else!
I put in a pr to add it to that Private Set section yesterday.