Photo by Eric Er on Unsplash

Article

Authentication in NestJS

NestJS authentication is built from guards: one checks a password and issues a token, another verifies that token on every later request. This chapter wires Passport's local and JWT strategies into a Nest app, then protects every route by default with a global guard and a @Public() opt-out.

Article

Authorization in NestJS

Once a NestJS request has a user, authorization decides what that user may do. This chapter builds role checks from a typed decorator and a guard, orders them after authentication, adds a @CurrentUser() parameter, and moves ownership checks into the service where the data is.

Tags

Search articles

Type a word to search published articles.

Open the search page