This project is a simple Node.js application demonstrating user authentication using JSON Web Tokens (JWT). It includes endpoints for login, protected resource access, and logout, implemented using Express and jsonwebtoken
.
- Clone the repository.
- Install dependencies with
npm install
. - Set up environment variables as described in
.env.example
.
- Run the server with
npm start
. - Access the
/login
endpoint to authenticate. - Access the
/protected
endpoint with a valid token to access protected resources. - Access the
/logout
endpoint to log out.
JWT_SECRET_KEY
: Secret key used for JWT token encryption.