Storing ab access token in memory server-side in NextJS
How can i store a token in-memory server-side in a Next.JS project?
I tried doing this: then i have a function that gets it, or refreshes it depending on expiration time... the problem however is that it goes back to
undefined
, after being set for some reason. lets say i have this API route handler to test getting a token: /api/test/
:
if i curl http://localhost:3000/api/test
i will get the same token back and i will get the stored one until go to different routes, and then come back to curling the test it is undefined. what am i missing here? maybe it gets redeclared somehow?0 Replies