Introduction
JWT-based Discord authentication for Next.js that doesn't suck
- Works with Next.js 15
- No database required
- Returns all user data from Discord
- Fully server-side
- Support for Server Actions and Route Handlers
- Designed for easy migration from AuthJS
There are many good auth libraries for Next.js, but most of them don’t provide good Discord support, or require a database, or are just plain bad.
- Better Auth is great, but requires a database making it complicated for simple projects.
- SST’s OpenAuth also requires a database.
- AuthJS does allow fully JWT-based sessions, but does not provide the Discord user ID out of the box (rendering it basically useless), and requires a hacky workaround to get it working.
- Clerk is great if you like vendor lock-in :P
This package aims to provide a simple, server-side solution for Discord authentication that works out of the box with Next.js.
You can see a live demo of this package in action at
https://next-discord-auth-demo.maamokun.workers.dev
Open Source
Section titled “Open Source”This package is open source and available under the WTFPL License.
Feel free to contribute or use it in your projects!