Join our community

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

7-15 Grant Access to the Course

In this lesson, we update our middleware to only allow access to the course if it’s been paid for.

We first create a hasAccess endpoint that looks for the CoursePurchase object. If it exists, the user is allowed access.

Then we update our route middleware and server middleware to use this new endpoint to control access.

In our route middleware, we also have to handle the case where the user logs in with Github but hasn’t purchased the course. Instead of letting them get into this weird state, we’ll immediately log them out instead.

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.