Test the complete JWT authentication flow with middleware
Test the JWT middleware by calling a protected endpoint. The token will be sent in the Authorization header.
1. Token Generation: When you register or login, the server generates a JWT token containing your user information.
2. Token Storage: The token is stored in your browser's localStorage and automatically included in API requests.
3. Middleware Verification: Protected routes use the authenticateToken middleware that:
Authorization: Bearer <token> headerreq.user if valid4. Protected Routes: Routes using authenticateToken middleware can access req.user to get authenticated user data.