-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
isAuthenticated is undefined after reload #64
Comments
Looks like you're checking for
I'll close this issue because it's not related to the SDK itself. If you have more questions, feel free to use https://community.auth0.com/ or open an issue in the sample repo: https://github.com/auth0-samples/auth0-react-samples |
Same problem. Not saving auth session. Even on auth0-react-samples. |
Same here. |
I ran into this, and turns out it's due to using Angular's HashLocationStrategy. |
I had the same problem. After i reload the page i dont want to run |
@bermichel it shouldn't take 30s to init. Have you checked this? https://github.com/auth0/auth0-spa-js/blob/master/FAQ.md#why-does-the-auth0client-object-take-a-long-time-to-initialize |
Your index.tsx needs to be wrapped with
|
Anyone else struggling with this, also ensure your application does not use the Auth0 development keys for social login! |
In my case the problem was that I was redirecting before waiting for <PrivateRoute path="/">
<Redirect to={{ pathname: "/foo" }} />
</PrivateRoute> and needed to update my function PrivateRoute({ children, ...rest }) {
const { isAuthenticated, isLoading } = useAuth0();
if (isLoading) {
return null;
}
return (
<Route
{...rest}
render={({ location }) =>
isAuthenticated ? (
children
) : (
<Redirect
to={{
pathname: "/login",
state: { from: location }
}}
/>
)
}
/>
);
} |
So i tried to make things work with the described example from the react wrapper, also managed to make things work. The problem we have right now is when reloading the app the isAuthenticated is always undefined. We wrapped the Code inside a AppContext wich provides these things for other components and than loads an AuthenticatedApp or UnauthenticatedApp. When flushing the cache and reload the whole Application everything works, but after hitting reload again the isAuthenticated is always undefined. Maybe someone is having the similiar issues.
Code for App:
And Code for the Provider:
And the index.tsx:
The text was updated successfully, but these errors were encountered: