AlejandraTech / viver-cellers

Web project dedicated to marketing wines for the winemakers of Vilafranca del Penedés who are part of the Viver del Cellers project.
4 stars 0 forks source link

PR 25: Implementation of authentication logic for login #45

Closed AlejandraTech closed 4 months ago

AlejandraTech commented 4 months ago

Implementation of authentication logic for login

Response to issue #23

Description:

The necessary logic has been implemented to ensure the correct functioning of the login in the application. This process involves communication between the frontend developed in Angular and the backend developed in Laravel.

Tasks:

Considering this implementation, the login flow works as follows:

  1. The user completes the login form with their email and password in the frontend.
  2. The form data is sent to the login method of the AuthService service in Angular.
  3. The AuthService service makes a POST HTTP request to the Laravel backend, specifically to the /login route.
  4. In the backend, the login method of AuthController.php verifies the user's credentials.
  5. If the credentials are valid, a JWT access token is generated and returned to the frontend along with the user information.
  6. The frontend receives the access token and user information, stores them locally, and redirects the user to the home page (/home).
  7. In case of invalid credentials, an authorization error is returned to the frontend.