Laravel Backends for Vue.js 3 and Nuxt
Plans from $25/month

This lesson is for members. Join us?

Subscribe now to get instant access to this course, plus a full library of Vue.js courses tailored to the plan you choose.

Register Users with Laravel Fortify for a Vue.js SPA

In this lesson, we start adding the Vue.js code to get the registration page working. This requires making an ajax request to the /api/register route provided by the Laravel backend.

We also need to ensure we have the CSRF token set as a cookie. You can do this once on load, by making a request to /sanctum/csrf-cookie.

We also setup axios to include cookies in the ajax requests with the withCredentials option.

? NOTE: if you'd prefer to use Nuxt's built in $fetch function instead of axios we've added a new video to the end of the course that shows you how

Links