I'm new to React, Node, and Next.js so please bear with me! I've been having trouble finding another example with the same use case as my app, so I'm hoping someone can point me in the right direction.
Basically, my approach is I'm authenticating against an external API and storing the API auth token in a Redis session. The Redis session middleware sets a session cookie upon successful login. Client side fetching works fine (Fetch w/credentials: include), but I'm at a loss on how I can pass the session cookie to getInitialProps when server rendering. Not sure if that would work or not...
A quick follow up - I figured it out. I have access to the session data in getInitialProps and set the token as a custom header. In my model, I check whether the session token or request token header have a value or not. I'll research any possible security implications and report back. Hopefully I can find some time to post a quick example (Express, Redis, and managing external API tokens).
@ccachor I'm closing this issue but feel free to ask questions again here or in the slack channel.
Most helpful comment
A quick follow up - I figured it out. I have access to the session data in getInitialProps and set the token as a custom header. In my model, I check whether the session token or request token header have a value or not. I'll research any possible security implications and report back. Hopefully I can find some time to post a quick example (Express, Redis, and managing external API tokens).