What is the best strategy to deal with JWT in Nextjs?
With React, I retrieve user and token information with context or local storage anywhere in the app. How to get context data in a server component?
8 Replies
Why resort to JWT in the first place
Usually not the best or simplest solution
Its the only auth method i know how to use. I'm using Nestjs for my back-end. Could you sugest another option?
Db session
Do you have some material so i could learn about?
If you’re using next auth there is tons of documentation on it. If you’re attempting to build your own auth… just remember there’s a reason it’s not something people do all the time
JWT can have many advantages if you implement them correctly
just don't store them in LocalStorage
Authentication - OWASP Cheat Sheet Series
Website with the collection of all the cheat sheets of the project.
It’s only really useful for stateless auth and few projects need that