Welcome to the repository for the JWT Protected API, a secure RESTful API that provides user authentication and protects resources using JSON Web Tokens (JWT).
- Project Overview
- Functionalities
- Technologies
- Installation
- Usage
- Contributors
- Contributing
- Acknowledgements
The JWT Protected API project provides a secure backend solution for user authentication and access to protected resources. It uses JWT for authentication, enabling users to log in, receive tokens, and access protected routes.
- User authentication (#, login, token refresh)
- Protected API endpoints that require JWT for access
- Secure handling of access and refresh tokens
- Error handling for authentication and authorization failures
- Framework: Node.js, Express.js
- Database: MongoDB
- Authentication: JWT (JSON Web Tokens)
- Password Hashing: bcrypt
- Environment Variables: dotenv
- HTTP Client: Axios
- Framework: React
To set up the JWT Protected API project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/RIADH-NOURI/Jwt-project.git cd Jwt-project/service
-
Install dependencies:
npm install
-
Configure the environment variables: Create a
.env
file in theservice
directory and add the necessary configurations:PORT=3000 DATABASE_URL=your_database_url ACCESS_TOKEN_SECRET=your_jwt_secret REFRESH_TOKEN_SECRET=your_refresh_token
- Run the application:
npm start
-
Navigate to the frontend directory:
cd ../client
-
Install dependencies:
npm install
-
Run the application:
npm start
- Run the backend server: Start the backend server using
npm start
in theservice
directory. - Run the frontend application: Start the frontend application using
npm start
in theclient
directory.