In this episode, we dive into installing Laravel Fortify, which is a flexible authentication package you can use with Laravel. Once you get this set up, you get everything you need for basic auth like registration, login, and logout. Plus, it can handle more advanced features like two-factor authentication.
We walk through how to actually install the package and run the necessary commands, including database migrations that add columns needed for things like two-factor auth. After installation, we take a tour of the changes Fortify makes to your app—like the new Actions
directory, which gives you a way to customize things like how users are created or how profile updates work.
You'll also see that Fortify registers a bunch of new authentication-related routes. These aren't handled by controllers you write, but you can still customize pretty much everything about them later if you need to. We also talk a bit about how these routes are registered as web routes (not API routes by default), so you'll want to keep your route config up to date if you're working with an API.
Finally, we do a little bit of clean up—removing the default web route—since we're focusing on building an API. Now we're all set up with Fortify and ready to start hitting these new auth endpoints from the client side!