In this episode, we dive into setting up authentication for our Nuxt app using Laravel Sanctum! There are tons of Nuxt auth solutions out there, but we're focusing on a package designed just for working with Laravel Sanctum: nuxt-laravel-sanctum-auth
.
First, we walk through installing the package in our Nuxt (client) project. Once that's done, it gets added as a module in our nuxt.config
. The most important setup here is telling our app where our API lives (the base URL). We set this to http://api.test
(which should be your Laravel backend running locally).
There's also some mention of extra config options, like customizing redirect routes for things like login, which we can adjust as we build more features. For now, we keep it simple and lean on saner defaults since we're using Laravel Fortify on the backend.
To wrap up, we take a quick look at what the package gives us: a set of handy composables (like useSanctumAuth
) that make it easy to wire up login forms and other authentication features without writing them from scratch.
In the next episode, we'll test our setup by sending our first authentication request. Stay tuned!