ansopedia / user-service

The Ansopedia User Service is a backend service responsible for managing user accounts and authentication within the Ansopedia learning platform. It provides functionalities like authentication & authorization, profile management.
4 stars 1 forks source link

Update Login API to Allow Users to Log In via Email or Username and Password #41

Closed sanjaysah101 closed 2 weeks ago

sanjaysah101 commented 2 weeks ago

Description:

The current login API only allows users to authenticate using their email and password. To improve user flexibility, we need to update the API to support login using either email or username along with a password.

Tasks:

  1. Update API Endpoint:

    • Modify the existing login API to accept both email and username as valid inputs for authentication.
    • Ensure that the input is validated to determine whether it is an email or a username.
  2. Backend Logic:

    • Adjust the backend authentication logic to check the database for a matching record using either the email or username.
  3. Error Handling:

    • Implement proper error handling for scenarios where the email/username or password is incorrect.
    • Provide meaningful error messages in the API response.
  4. Testing:

    • Write unit and integration tests to validate the new login behaviour.
  5. Documentation:

    • Update API documentation to reflect the new login functionality.
    • Include examples of API requests and responses for both email and username login scenarios.