
Learn to build authentication with Angular and Laravel, including login with http-only cookies via Sanctum and forgot-password reset via email. See the navigation menu update after login, showing user names.
Install Laravel by installing composer, choosing a global installer or command, creating a Laravel OAuth project, and launching the local server with php artisan serve to verify installation.
Create and connect a new database and schema. Run migrations to create users, password_resets, and jobs tables, then adjust the user model to first_name and last_name.
Create Laravel api routes by removing the default route, adding a hello route, and wiring it to an OAuth controller that returns hello from controller; test with Postman.
Create the register api using a post request to form a new user with first name, last name, email, and a hashed password, returning the user with 201 created.
Create a register request in Laravel, validating first name, last name, email (format and unique), password, and password confirmation. Generate RegisterRequest with artisan and trigger validation using the X-Requested-With header.
Install Laravel Sanctum via composer, publish the service provider, update the sanctum config, migrate to create the personal access tokens table, and add API tokens to the user model.
Log in with email and password via a Laravel login function, handle failed attempts with a 401 unauthorized error, and generate a JWT token for the authenticated user.
Retrieve the current authenticated user from a JWT by creating a user function and securing the route with OAuth Sanctum middleware, showing how to pass the token and verify authentication.
Implement HttpOnly JWT cookies in Laravel by issuing a one-day login cookie. Override authentication middleware to read the cookie and set the authorization header, enabling credentials for cookie sharing.
Log out by removing the authentication cookie through a post request, deleting the JWT cookie, and returning a success response to unauthenticate the user.
Implement forgot password flow by sending a reset email through mailhog, creating a password controller with forgot method, generating a token, and storing it in password_resets.
Implement a reset password flow using a token, validate input, fetch the password reset record, locate the user by email, hash and save the new password, and return success.
Create and initialize an Angular frontend project, add routing and CSF, then run the app on localhost:4200 to see it up and running.
Explore angular navigation by building and wiring login, register, and home components, configuring router links and an outlet to enable seamless page routing.
Create a register page with a template, build a reactive form (first name, last name, email, password, confirm), submit to /register, and navigate to login on success.
Implement a login flow with email and password, handle successful authentication by redirecting to the main page, and use an interceptor to attach cookies via with credentials for subsequent requests.
Fetch authenticated user in the home component using http get to /user, display first and last name on success, and show an error with a logout option on failure.
Implement logout by sharing authentication state with an event emitter between home and nav components. Subscribe to authentication events, toggle authenticated state, call the logout endpoint, and redirect to login.
Build the forgot password page, post the email to the forgot endpoint, and show success or error alerts with a reset link.
Learn to implement an Angular and Laravel password reset flow with a reset form, token routing, and post-reset navigation to login.
Learn how to authenticate using Angular and Laravel.
In Laravel you will learn:
Create public and secure routes
Connect with MySQL
Run Migrations
Register Users
Generate Jwt Tokens
Use HttpOnly Cookies
Send Emails
In Angular you will learn:
Use Angular CLI
Create components and routes
Consume API calls
Use Event Emitters
If these are what you are looking for then this course is for you.