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.