This project implements a user authentication system with features including login, signup, password recovery through OTP generation, and token-based authentication.
- Login: Users can log in with their credentials.
- Signup: New users can create an account.
- Forget Password: Users can request a password reset.
- OTP Generation: An OTP (One Time Password) is sent to users for verifying password reset requests.
- Token Handling: Secure token generation and validation for user sessions.
To run this project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/nerdyawedee/Login_Signup_ForgetPassword.git cd Login_Signup_ForgetPassword -
Install dependencies:
npm install
-
Set up environment variables:
- Create a
.envfile in the root directory and add the necessary environment variables (e.g., database connection strings, API keys, etc.).
- Create a
-
Run the application:
npm start
Once the application is running, you can interact with it through the provided endpoints.
Here are the main endpoints provided by the application:
-
POST /signup: Create a new user account.
- Request Body:
{ "username": "your_username", "email": "your_email@example.com", "password": "your_password" }
- Request Body:
-
POST /signin: Log in with your credentials.
- Request Body:
{ "email": "your_email@example.com", "password": "your_password" }
- Request Body:
-
POST /forgot-password: Request a password reset.
- Request Body:
{ "email": "your_email@example.com" }
- Request Body:
-
POST /otp: Reset your password using the OTP.
- Request Body:
{ "otp": "your_otp", "newPassword": "your_new_password" }
- Request Body:
-
GET /profile: Get the logged-in user's profile. Requires authentication token.
- Headers:
Authorization: Bearer <your_token>
- Headers:
Contributions are welcome! Please create an issue or submit a pull request.
- Fork the repository.
- Create a new branch.
git checkout -b feature-branch
- Commit your changes.
git commit -m "Descriptive commit message" - Push to the branch.
git push origin feature-branch
- Create a Pull Request.
This project is licensed under the MIT License. See the LICENSE file for details.