Hello I'm new to NextJS and React, but my project currently has a 3rd party api that I'm working with that requires a session token input in the header for all requests.
So I picked next-Auth
for authentication but I have problem accessing that chunk of raw jwt.
I tried
useSession
but it only gives me info within JWT (users, expiration, etc). I found a server side function in documentation calledgetToken()
but the sample requires a line like this:
const secret = process.env.SECRET
Does that mean i need the secret key to the jwt signature in order to retrieve the raw jwt?
I can see that session token in my cookie under my localhost file and I tried to use js-cookie to get()
that cookie, but I still can't get deeper to get the inner cookies
. I wonder how I should approach this problem and what's the proper way to attach session token in API requests for next-auth setup.
Thanks!