I'm writing a NodeJS app that runs on a server and queries a remote API on a schedule. This API requires authentication, and gives me a token that is valid for a number of hours.
What's the best way to store and reuse this token, and only reauthenticate when it expires?
This is the first Node app that I've written, so I'm not sure exactly how to ask the question. Is there a common library that would handle this for me?
If not, and I have to write my own module, what's an acceptable way to store the credential? Should I be using a global variable, a state store like Redux, or am I way off the mark?