arshadpatel / codeX100

codeX100 is an interactive platform designed to provide high-quality programming courses and educational content across multiple languages and technologies. Whether you're learning the basics of C, C++, Java, Python, or delving into Data Structures and Algorithms (DSA), codeX100 caters to learners of all levels.
10 stars 85 forks source link

Implement JWT Authentication, Signup, and Login Functionality #45

Closed Ryadav0654 closed 1 month ago

Ryadav0654 commented 1 month ago

Title: Implement JWT Authentication, Signup, and Login Functionality

fixes: #12

Description:

This PR introduces JWT (JSON Web Token) based authentication for securing API endpoints. The following features have been implemented:

  1. JWT Authentication Setup:

    • JWT is now used to generate and verify authentication tokens for user sessions.
  2. Signup Endpoint (/signup):

    • Users can now create an account by providing their details (e.g., username, email, password, etc.).
    • Passwords are securely hashed before storing in the database.
    • User data is saved in MongoDB .
  3. Login Endpoint (/login):

    • Users can log in by providing valid credentials.
    • Upon successful authentication, a JWT token is returned, which can be used to access protected endpoints.
  4. Database Integration:

    • MongoDB is used to persist user data.

Key Changes:

Testing:

Screenshot 2024-10-05 225410 Screenshot 2024-10-05 225450

Let me know if you have any suggestions or feedback! Thanks!

Ryadav0654 commented 1 month ago

Hi @arshadpatel ,

I have created this pull request. Could you please review the changes when you have time? Your feedback would be appreciated!

Thanks!

Ryadav0654 commented 1 month ago

@arshadpatel Thank you for merging the PR! I appreciate the opportunity and look forward to contributing more in the future.

arshadpatel commented 1 month ago

Thank You.

Ryadav0654 commented 1 month ago

Thank You. Hi @arshadpatel , please add hactoberfest-accepted label. Thank you!