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:
A login method has been created in AuthController.php in Laravel to handle user authentication.
A POST route has been defined in the api.php file of Laravel that points to the login method in AuthController.php.
An AuthService service has been developed in Angular to manage operations related to authentication and user management, connecting with the Laravel backend.
A LoginComponent has been implemented in Angular that contains a form for logging in.
Validations have been added both in the frontend and backend to ensure the integrity of the data entered during login.
Considering this implementation, the login flow works as follows:
The user completes the login form with their email and password in the frontend.
The form data is sent to the login method of the AuthService service in Angular.
The AuthService service makes a POST HTTP request to the Laravel backend, specifically to the /login route.
In the backend, the login method of AuthController.php verifies the user's credentials.
If the credentials are valid, a JWT access token is generated and returned to the frontend along with the user information.
The frontend receives the access token and user information, stores them locally, and redirects the user to the home page (/home).
In case of invalid credentials, an authorization error is returned to the frontend.
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:
login
method has been created inAuthController.php
in Laravel to handle user authentication.POST
route has been defined in theapi.php
file of Laravel that points to thelogin
method inAuthController.php
.AuthService
service has been developed in Angular to manage operations related to authentication and user management, connecting with the Laravel backend.LoginComponent
has been implemented in Angular that contains a form for logging in.Considering this implementation, the login flow works as follows:
login
method of theAuthService
service in Angular.AuthService
service makes aPOST
HTTP request to the Laravel backend, specifically to the/login
route.login
method ofAuthController.php
verifies the user's credentials./home
).