Relative Content

Tag Archive for node.jsjwttokennext.js13nextjs14

How can I use JWT in Back-End of my Next.js 14 (App Router) project?

I’m developing a food sharing website with Next.js 14, and Node.js and MongoDB database in Back-End.
I need users to be authenticated to access some pages (like form of sharing a food), but I have no idea how I can generate JWT token in the server action function of login form (if the user exists). And I don’t know if I should store the token in the database or not? How can we find out which user a JWT token is for?