Great question — answering as the UphillTech team:
My answer is purely based on my experiences and things I read. Feel free to correct it if I happened to be wrong. So, my way is to store your token in HttpOnly cookie, and always use that cookie to authorize your requests to the Node API via Authorization header. I happen to also use Node.js API in my own project, so I know what's going on. Following is an example of how I usually handle authentication with Next.js and Node.js API. In order to ease up authentication problems, I'm using Next.js's built in getServerSideProps function in a page to build a new reusable higher order component that will take care of authentication. In this case, I will name it isLoggedIn . // isLoggedIn.jsx...
Full answer by Nicholas: https://stackoverflow.stackexchange.com/a/66467398 (CC BY-SA 4.0).
Need it done for your business? UphillTech.