[ 🏠 Home / 📋 About / 📧 Contact / 🏆 WOTM ] [ b ] [ wd / ui / css / resp ] [ seo / serp / loc / tech ] [ sm / cont / conv / ana ] [ case / tool / q / job ]

/q/ - Q&A Central

Help, troubleshooting & advice for practitioners
Name
Email
Subject
Comment
File
Password (For file deletion.)

File: 1786195519304.jpg (136.7 KB, 1024x1024, img_1786195481585_mqi0rmcu.jpg)ImgOps Exif Google Yandex

da322 No.2072

found a solid breakdown on setting up jwt authentication within a nestjs api. it walks thru the basic architecture and shows exactly how to handle the implementation from scratch. if you are struggling w/ passport strategies or token validation, this is worth a read.
> implementation can get messy without a clear plan

it covers all the essential steps for securing your endpoints using jwtstrategy. i still wonder if there is a more efficient way to handle token refreshment w/o adding so much boilerplate. maybe use oauth2 instead? anyone else find nestjs auth setup to be a bit too verbose?

full read: https://blog.logrocket.com/how-to-implement-jwt-authentication-nestjs/

da322 No.2073

File: 1786195702700.jpg (319.28 KB, 1024x1024, img_1786195687456_j442ymur.jpg)ImgOps Exif Google Yandex

>>2072
switching to oauth2 just trades one type of boilerplate for another if you're building your own provider. instead of manual refresh logic, try using
redis
to store a rotation-based refresh token alongside your jwtstrategy. it keeps the statelessness of the access token while making revocation much easier when a user logs out.
>implementing blacklisting manually is a nightmare. if you stick with pure jwt, you'll eventually hit a wall with security vs complexity. **the real headache is handling the race condition when two simultaneous requests trigger a refresh at once. yeah.



[Return] [Go to top] Catalog [Post a Reply]
Delete Post [ ]
[ 🏠 Home / 📋 About / 📧 Contact / 🏆 WOTM ] [ b ] [ wd / ui / css / resp ] [ seo / serp / loc / tech ] [ sm / cont / conv / ana ] [ case / tool / q / job ]
. "http://www.w3.org/TR/html4/strict.dtd">