graphql-jwt-tutorial
graphql-jwt-tutorial copied to clipboard
Only allows one user to be logged in
I appreciate all the work that went into this and the tutorial it was very insightful. I think currently though with the code implementation in this repo it will not allow for multiple different people to be logged in. Inside of auth.js you set inMemoryToken but it is shared across all users. For example if I start the app in development mode and login it will set inMemoryToken just fine. Now if I open another Browser in incognito it thinks I am still logged in as the other user because inMemoryToken already exists.
Do you know of a workaround for this?
It appears that it may be caused by the way node is caching the module on the very first request. Node is retrieving the tokens properly and storing them inside inMemoryToken as expected but then this gets cached and reused on every subsequent request to node. The client side works as expected but the server side does not.