
Nuxt 3 Authentication with Laravel Sanctum:A Practical Guide
Introduction
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.
What you'll learn in this Course:
- Learn how to Develop a starter kit with Login/Registration features using Laravel Sanctum, Fortify and Nuxt 3 as the frontend stack
- Learn how to set up a Laravel project with Sanctum and Fortify.
- Learn how to Implement authentication in Nuxt 3 with a Laravel Backend
- Learn how to configure and use Laravel Sanctum to communicate with a Single Page Application (SPA)
- Learn how to Implement Two Factor Authentication (2FA) with Laravel, Fortify and Nuxt
- Learn how to Implement Roles/Permissions in an API/SPA Environment
- Learn how to Use API Resources in Laravel to format the data accordingly
- Learn how to Implement Middlewares like Authenticated and Guest Middlewares to protect pages accordingly
- Learn how to Build a mini Students Management System from Scratch
- We'll also learn how to implement Server Driven Paginations, Search Functionality along with Filter By Class.
Prerequisites:
- Beginner-level knowledge of PHP/Laravel is Required
- Beginner Level knowledge of Nuxt and VueJS is required
Who is this Course for:
- Students who want to Integrate Laravel as a Backend with a Nuxt Frontend
Projects Roadmap and Status:
[Uploaded] Setting Up Laravel and Nuxt
[Uploaded] A Guide to Implement Two Factor Authentication (2FA) with Laravel and Nuxt
[Uploaded] Building a Students 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.
Building a Students 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.