
Install fresh backend and frontend projects in a single Nuxt Laravel folder, setting up a Laravel backend with SQLite and a Nuxt frontend via npm.
Configure Nuxt to serve frontend and backend on the same domain using backend.test, adjust dev server settings, and restart npm to enable domain-shared hosting for future Sanctum session-based authentication.
Configure Laravel Sanctum to enable cookie-based, stateful authentication between front end and back end for a single page application, and adjust env, cors, and session settings.
Install and configure the Nuxt auth sanctum module to enable cookie-based, SSR-ready Laravel Sanctum authentication, using a sanctum composable, CSRF handling, and pre-configured middlewares like auth and guest.
Test the Laravel Sanctum configuration by making a login request from a Nuxt 3 app, register pages, and verify authentication flow with a backend route.
Install tailwind CSS and set up a default layout to structure the Nuxt app with a dashboard and Nuxt link navigation. Prepare for Laravel Fortify authentication in the next lecture.
Install and configure Laravel Fortify to implement login plus registration, password resets, and email verification with optional two-factor authentication in a Nuxt Laravel project.
Grab the authenticated user from the use sanctum auth composable and render their name in navigation, while refining the login and nav design.
Learn how to use Laravel API resources to format front-end data, including nested user and post relationships, wrapping behavior, and disabling the data key, plus defining a TypeScript user interface.
Define a TypeScript interface for the login form with email and password, wire it into the login view for autocomplete, and note middlewares like auth and guest.
Protect pages with Sanctum auth and Sanctum guest middlewares, redirecting unauthenticated users to login and authenticated users away from guest pages. Configure titles with define page meta and use head.
Implement and test logout with the Nuxt sanctum auth composable, wiring a logout button to an async action, include the logout route, and use on logout redirect for post-sign-out navigation.
Implement a Nuxt frontend registration flow with Laravel Fortify and Sanctum, building a register page with name, email, password, and confirmation and posting to /register.
Move registration logic from the user interface to a dedicated composable named use auth, using sanctum and refresh identity to update authentication status and render the dashboard.
Render server-driven validations in a Nuxt 3 app by handling 422 responses during user registration, displaying field-specific errors (name, email, password) and applying conditional styling to highlight invalid inputs.
Implement a profile update flow by adapting the registration form into a profile form for name and email, using sanctum auth and refresh identity to reflect changes.
Enable two factor authentication in the Nuxt front end by leveraging Laravel Fortify, using the two factor secret, recovery codes, and confirm flag to toggle activation.
Implement a password-confirmation flow for enabling two-factor authentication in a Nuxt 3 and Laravel Sanctum setup, wiring the confirm password endpoint and rendering the QR code.
Enable two-factor authentication by activating it via backend, retrieving QR code SVG for a user, and guiding the user to scan with an authenticator app and enter a six-digit code.
Finalize the two factor enable flow by posting the six digit code to the user/confirmed two factor authentication url, then refresh the identity and route to the account page.
Show the two factor challenge during login, verify the six digit code from the authenticator app via the two factor challenge endpoint, then refresh identity to complete sign-in with Sanctum.
Disable two factor authentication in a Nuxt 3 app by deleting the endpoint and confirming the password, then refresh the user identity and redirect to the account page.
Define unit (class) and section models with migrations, factories, and seeders to build a students management crud, then create a student model linked to unit and section with eager loading.
Render authenticated student data with a Nuxt 3 frontend and Laravel Sanctum. Use API routes, resources, and composables to fetch and display students, units, and sections.
Implement the record creation flow with dependent dropdowns, server-side validation, and database storage, including API endpoints for classes and sections and handling validation errors.
Implement a dependent dropdown flow that filters sections by the selected unit id when a class is chosen, using a backend api and frontend composables to fetch and render data.
This lecture finalizes the record creation flow in a Nuxt 3 app with Sanctum, implementing server-driven validations, displaying errors, and redirecting after create.
Implements the record update flow by building a backend update method with route model binding and a Nuxt front-end that fetches, pre-fills, and submits updates via a dynamic id.
Implement the delete operation in the CRUD workflow by adding a backend destroy method, a front-end delete action with confirmation, and updating the displayed records.
Implement pagination in Nuxt 3 by building a frontend pagination component that uses backend metadata (total, current page, links), renders labeled links, and navigates pages via URL-derived numbers.
Finalize pagination by appending the page parameter to the students URL and triggering fetches when the URL changes, validating page navigation from 1 to 3.
Implement search in the student management system by adding a scope search that filters by name or email using a like query with wildcards from the front end.
Implement filter by class by extending the search scope to include unit id, render a class dropdown populated from fetched units, and reset pagination when a new search starts.
Explore the database structure for roles and permissions, including models and pivot tables role_user and permission_role, to enable many-to-many relationships between users, roles, and permissions.
Define the role and permission models with migrations and seeders, create role_user and permission_user pivot tables, establish many-to-many relations with users, and seed admin and user roles and permissions.
Register permissions as gates using a new Laravel auth gates middleware, eager load roles and permissions, and implement backend checks in controllers for student list, create, edit, show, and delete.
Explain how to pass user permissions from Laravel Sanctum to the Nuxt frontend, render UI elements conditionally, and use a frontend permission middleware to redirect unauthorized users.
Resolve the login flow in Nuxt 3 authentication with Laravel Sanctum by refreshing identity after sign-in, enabling automatic redirects to the two-factor challenge or the dashboard.
Replace the browser history on login by using replace: true when redirecting to the dashboard, preventing back navigation to the login page and ensuring the auth middleware redirects guests.
Unlock the power of full-stack development with our step-by-step guide to authenticating with a Laravel API from a Nuxt front-end. This course is designed to take you from the basics to advanced features, ensuring you understand how to secure your applications effectively.
This course covers everything you need to get started with authentication with Nuxt and Laravel. We’ll start by setting up a Nuxt project and configuring Laravel Sanctum, then add the ability to register, sign in, and sign out.
We’ll also cover some TypeScript tips, protecting pages with middleware, and using Vue composables to keep our code tidy.
Projects Roadmap and Status:
[Uploaded] Setting Up Laravel and Nuxt
[Uploaded] A Guide to Implement Two Factor Authentication (2FA) with Laravel and Nuxt
[Uploaded] Let's Build a Student Management System
[Uploaded] A Guide to Implement Roles/Permissions in an API/SPA Environment
[Uploaded] Miscellaneous Issues and Fixes
Project Description:
Building an Authentication System
We'll start by setting up a fresh Laravel project with Sanctum and Fortify, configuring everything step-by-step, and then we'll implement the ability to authenticate from Nuxt with the nuxt-auth-sanctum module.
Section Highlights:
Set up a fresh Laravel project with Sanctum and Fortify.
Learn how to properly configure Laravel Sanctum to be able to communicate with a front-end SPA easily
Learn how to properly configure a Nuxt frontend (along with Nuxt-Auth-Sanctum) to communicate with a Laravel Backend.
Configure and implement authentication using the Nuxt-Auth-Sanctum module.
Build a simple yet effective authentication module.
Create a simple yet beautiful starter kit with authentication features like Login, and Registration.
Learn how to implement middlewares like Authenticated and Guest Middlewares to protect pages Accordingly
Learn how to use API Resources in Laravel to format the data accordingly
A Guide to Implement Two Factor Authentication (2FA) with Laravel and Nuxt
In this section, we'll explore how to implement Two Factor Authentication (2FA) with Laravel and Nuxt. We'll use the Laravel Fortify package to handle the 2FA logic, and then we'll integrate it with the Nuxt-Auth-Sanctum module.
Section Highlights:
We'll learn how to Enable and Disable 2FA with Laravel Fortify.
We'll also implement the Password Confirmation flow so that users have to confirm their password before enabling/disabling 2FA.
And finally, we'll show the two-factor challenge when the user tries to log in, this will only be shown if 2FA is enabled.
Let's Build a Student Management System
In this section, we'll build a simple CRUD app and dive into the fundamentals of building CRUD applications with Laravel, Sanctum, and Nuxt 3, we will learn the following topics along the way:
Learn about Watchers in Vue.js and Build dependent dropdowns.
Learn how to work with Factories and Seeders in Laravel, and seed the necessary data for all of our Models
Learn how to Implement Server Side Pagination from scratch.
Learn how to Implement Search Functionality from scratch, this includes multi-column search.
Learn how to Implement Filter By Class Functionality from scratch.
Learn how to display server-driven validation errors.
And many more.
A Guide to Implement Roles/Permissions in an API/SPA Environment
In this section, we'll learn how to implement Roles/Permissions in an API/SPA Environment.
We'll start with the backend first by implementing the necessary models/migrations and seeders.
Then we'll implement authorization checks on both the frontend and backend to ensure that only authorized users can access certain resources.
Miscellaneous Issues and Fixes In this section, we'll cover some miscellaneous issues and fixes that you might encounter while building your application.
We'll learn how to fix the login issue that occurred when we implemented 2FA.
We'll also learn how to replace the history when logging in.
Whether you're a beginner looking to get started with API authentication or an experienced developer wanting to refine your skills, this course has something for you. Join us and enhance your development toolkit today!