In my last post, “Introduction to Web Apps with Next.js”, we went through the steps of setting up a new Next.js project, customizing a landing page, and implementing a very simple web application. In this post, we’ll implement an Open Authentication (OAuth) based Single Sign-On (SSO) API within Next.js using NextAuth.js. We’ll be using GitHub as our provider, but the steps here are very similar for other platforms, such as Google or Discord. This will allow us to place portions of our website behind a login screen, restricting access to certain content or APIs for anonymous visitors.
About the Author

Introduction to Web Apps with Next.js
In this post, I am going to demonstrate how to set up a simple Next.js web application. Next.js is a heavily opinionated JavaScript framework, in that it has a lot of conventions and recommended tools built into its design.
We’ll use Next.js version 14.2.2 to set up the groundwork for a simple web application. By “web application,” I mean an application that is designed primarily to collect input from a user in a web browser and return some output generated from that input.