ai-cfia / membrane-backend

Membrane Backend: A centralized authentication service for Single Sign-On (SSO) enabling seamless token-based email verification across multiple client applications.
MIT License
1 stars 0 forks source link

Merge login and verify_token Functions into a Unified authenticate Function #17

Closed CFIALeronB closed 1 year ago

CFIALeronB commented 1 year ago

Background:

Currently, our authentication process is divided between two separate functions, login and verify_token. This division can lead to fragmented code and potentially cause inefficiencies or discrepancies in our authentication flow. Objective:

To streamline and consolidate our codebase, it's proposed to merge the functionalities of login and verify_token into a single authenticate function. Tasks:

Combine Functionality: Integrate the logic from both login and verify_token into the new authenticate function.
Refactor Routes: Update routing to point to the new authenticate endpoint.
Error Handling: Implement comprehensive error handling in the authenticate function to manage all potential JWT and authentication-related issues.
Update Tests: Ensure all existing tests are updated to match the new authentication flow and extend coverage if necessary.

Acceptance Criteria:

Successful execution of the unified authenticate function that can handle both login and token verification.
All existing tests pass and new tests (if necessary) provide comprehensive coverage.
Routing updated to reflect changes without causing any broken links or endpoints.
Clear and informative error messages in the event of any authentication-related issues.