damien-hl/nuxt3-auth-example

use jwt

Closed this issue · 1 comments

hello,

actually i want to use this template for my project, and i need to use JWT , could help me what should i do to modify this temp according to JWT ?

thanks

Hello,

I think the easiest way to adapat this template to use JWT is to store the JWT token in a cookie.

I made an example on this branch where i used the jsonwebtoken package to issue a JWT token and then store it in the cookie.

Check server/utils/jwt.ts and server/api/auth/login.post.ts files to see how the JWT is created and stored in the cookie.

The online example is here:
https://nuxt3-auth-example-git-jwt-damienhl.vercel.app/

Good luck!