Getting Started
NuAuth is a JWT-based authentication library designed specifically for Next.js 15 App Router. This library aims to streamline JWT handling in Next.js apps by providing robust, flexible tools for managing tokens, securing API routes, and supporting both server-side and client-side authentication flows.
Installation
To install NuAuth, run the following command:
Environment Variables
Create a .env.local
file in the root of your project and add the following environment variables:
Configure
Import the NuAuth
function and any providers you want to use in your app. Then, create an instance of NuAuth
with your desired configuration options.
In this example, we're using the Google
provider to enable Google OAuth authentication:
Usage
Simply import auth
from your configuration file and use it in your Next.js app: