Closed jeromeky closed 6 years ago
I think the issue is that Apollo is not detecting that the token changed in localStorage and is using the token from the previous user. I had similar issues and resolved it by using location.reload()
in the login() callback.
I really don't know if this is the best way to do it and would appreciate it if someone could provide a better way to implement this.
Yes so far, I fixed that by doing a location.reload() in my logout method.
This issue comes from Apollo Cache (store). You need to update the store with new value after re-login.
I think you should use await apolloClient.resetStore()
when you login or logout the user.
Hi guys,
I'm using graph.cool as a graphQL baas, and they have a query to get the current logged-in user https://www.graph.cool/docs/faq/graphcool-session-user-goij0cooqu/
However when I'm doing the following scenario :
The issue is at point 5, the current user returned is User A, and not B.
I checked that the token is correctly removed in point 3, and we set the correct token from User B at point 4.
Also used the Apollo client chrome dev tool, and when I'm doing a query from it after logged in as User B, it will correctly return the User B.
So far I found out that If I refresh the page after signing out, it will correctly return the correct User.
This is how my integration looks like
Is my integration is wrong ? Or is there an issue when you set a new Authentification header.
Thanks for your help.