Join our community

Get access to the complete guide to developing and deploying fast, production-ready Nuxt apps.

4-8 Protecting Routes with Auth

Finally, we can now protect our routes using authentication!

It’s a fairly simple update to change our middleware to also check for a logged in user. Now we can freely access Chapter 1, but any other lessons require us to be logged in with Github. Once we build our checkout we’ll be able to restrict access only to those who have bought.

We also implement a UX improvement. If we redirect to the login page, we’ll redirect back to where the user was trying to go after they’ve logged in.

This course was originally built with Nuxt 3, but it's no longer being maintained. You can still follow the lessons, but make sure to use the exact dependency versions listed in the course repository to avoid breaking changes.

If you’re looking for the most up-to-date and fully supported version, we recommend Mastering Nuxt: Full Stack Unleashed , which uses Nuxt 4 and actively being maintained.