Skip to content

Conversation

@QUBITABHAY
Copy link

This pull request implements basic authentication logic for the /login, /profile, and /logout routes in src/server.js. The main changes add session-based authentication, ensuring that only logged-in users can access protected routes and log out.

Authentication and session management:

  • Added logic to the /login route to check credentials (username and password), set the session on successful login, and return appropriate success or error messages.
  • Implemented session-based protection for the /profile route, returning user info only if the user is authenticated, otherwise responding with an unauthorised error.
  • Added logout functionality to the /logout route, which destroys the session if the user is logged in and returns the appropriate status message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant