
JWT Authentication
Passport.js, JWT strategy, guards, bcrypt, refresh tokens, token expiration
1What is a JWT (JSON Web Token)?
What is a JWT (JSON Web Token)?
Resposta
A JWT is an open standard (RFC 7519) that defines a compact and secure format for transmitting information between parties as a JSON object. It is digitally signed to ensure its integrity and can be encrypted. JWTs are commonly used for stateless authentication in REST APIs because they contain all necessary information without requiring server-side sessions.
2What is the structure of a JWT?
What is the structure of a JWT?
Resposta
A JWT consists of three parts separated by dots: Header (signature algorithm and type), Payload (claims/data), and Signature (integrity verification). Each part is Base64URL encoded. Example: eyJhbGc.eyJzdWI.SflKxwRJ. This structure allows transporting data while ensuring it hasn't been tampered with.
3Which NestJS package is used to handle JWTs?
Which NestJS package is used to handle JWTs?
Resposta
@nestjs/jwt provides an abstraction around the jsonwebtoken package to facilitate JWT token generation and verification in NestJS. It integrates with the NestJS module system via JwtModule and exposes the JwtService with methods like sign(), signAsync(), verify() and verifyAsync(). It should be combined with @nestjs/passport for complete authentication.
What is the role of the JwtService.sign() method?
What is the role of the JwtService.verify() method?
+22 perguntas de entrevista
Outros temas de entrevista Node.js / NestJS
Node.js Fundamentals
Node.js Core APIs
Asynchronous Programming
Express.js Basics
NestJS Fundamentals
REST API Design
Validation & DTO
API Documentation & Contracts
Error Handling
Unit Testing
Task Scheduling
NestJS Modules & DI
Configuration & Environment Management
Authorization & RBAC
Database with TypeORM
Prisma ORM
Middleware & Interceptors
File Upload
WebSockets
GraphQL with NestJS
End-to-End Testing
Caching with Redis
Queues with Bull
DevOps, Logging & CI/CD
Docker & Containerization
Microservices
Security Best Practices
Performance & Cloud Deployment
Domine Node.js / NestJS para sua proxima entrevista
Acesse todas as perguntas, flashcards, testes tecnicos, exercicios de code review e simuladores de entrevista.
Comece gratis