🔒 Next Auth vs SST Auth

Sun, 20 Nov 2022

#sst #serverless #nextjs #oauth

In a previous article, I describe how to use SST Auth construct in order to implement an OAuth authentication workflow for your application. Next.js, the React framework for production is also providing a component named NextAuth.js that can be used to implement such authentication system. Let's compare the two solutions! 🤺

What is SST Auth?

SST is framework designed to build backend serverless applications initially. I have already written a couple of articles on this solution (here and here for example). It provides features to deploy web applications too (for example via the StaticSite construct) so it's advertised as a tool to build full-stack serverless applications.

The Auth module is a dedicated set of components built by the SST team to implement an authentication system inside your application. It works well with a web application like a React app.

What is NextAuth.js?

Next.js is probably the most famous React-based framework available today, and gain a lot of visibility in the last few years. Today with version 13, it's truly a full-stack framework solution with the support of server-side rendering options and an API layer. You can check for example the Theo Browne video: Next.js is a backend framework which is a good introduction to the backend part.

NextAuth.js is an independent library (not supported by Vercel), with the following motto: "Authentication for Next.js" It provides a built-in solution to implement an authentication system for Next.js, based on OAuth protocol.

You know the actors, it's now time to get to the comparison bullet points, let's fight 😇