Next.js Discord

Discord Forum

Authenticate to a backend API

Unanswered
Orinoco Crocodile posted this in #help-forum
Open in Discord
Orinoco CrocodileOP
Hi, I've a backend API written in go that accept JWT token for the authentication. I'm using nextauth.js for the authentication (google, and credentials), which gives me a JWT token and I would like to pass this token through each request (fetch - server component). What's the best way to handle it?
I know there is a lot of posts regarding this but I wasn't able to find the best answer for now so perhaps a discussion will help 🙂
Thanks a lot!

2 Replies

Jersey Wooly
Hey, which version of NextJs and NextAuthJs are you using ?
Orinoco CrocodileOP
Latest version of both projects (nextjs 14.1.0, nextauth 2.24.5)