sandrinodimattia / use-auth0-hooks

An easy way to sign in with Auth0 in your React application (client-side) using React Hooks
https://nextjs-spa-auth0-demo.now.sh/
MIT License
74 stars 31 forks source link

isAuthenticated flag is false after refresh #5

Open wityan opened 5 years ago

wityan commented 5 years ago

After refreshing the Page the isAuthenticated flag is false but in the cookie its set to true

sandrinodimattia commented 5 years ago

When you refresh the page your browser will execute a "silent authentication request" and receive a new id_token and access_token from Auth0. During that step, you'll have a second that isAuthenticated is false.

However, as soon as the new tokens are received (if the user still has a valid session with Auth0), you'll see that the flag updates to true.

Let me know if this helps.

sourceful-sharon commented 4 years ago

Hi -

It's not updating to true for me. False -> Login -> True. Refresh -> False again even though cookie is set.

I can see the call goes out to auth0 which returns 200 but I'm not able to capture that in the update when getting const { isAuthenticated, isLoading, login, logout } = useAuth();

sourceful-sharon commented 4 years ago

This seems broken on the actual example site too. Login to profile, refresh and you are logged out and need to log back in.

esteban89 commented 4 years ago

Any way to fix this? I'm running into this error

sandrinodimattia commented 4 years ago

All of the concepts of this library have been moved to the official Auth0 SDK for React (https://github.com/auth0/auth0-react), so I'll be archiving this repository shortly.