#NextAuth
Authentication session loss in Next.js 14/15? Outsource your NextAuth or Supabase bug fixing to dedicated developers.Fix Next.js auth bugs: tinyurl.com/5n8uba4w

#NextAuth #Supabase #WebDev
tinyurl.com
October 30, 2026 at 10:29 PM
Authentication session loss in Next.js 14/15? Outsource your NextAuth or Supabase bug fixing to dedicated developers.Fix Next.js auth bugs: tinyurl.com/5n8uba4w

#NextAuth #Supabase #WebDev
Website Maintenance, Optimization & Security Services | Fiverr
Fix, improve, and manage your website with online website maintenance & management services by freelance website experts. Affordable & remote.
tinyurl.com
October 29, 2026 at 4:47 PM
NextAuth / Auth.js Database Schema Explained
## The short version NextAuth (now Auth.js) creates 4 tables in your database: `users`, `accounts`, `sessions`, and `verification_tokens`. The `users` and `accounts` tables have a one-to-one relationship via `accounts.user_id`. Sessions link to users via `sessions.user_id`. Verification tokens are short-lived and self-cleaning. ## The 4 tables ### users Column | Type | What it means ---|---|--- `id` | text / UUID | Primary key. Generated by NextAuth. `name` | text | Display name from the OAuth provider (Google, GitHub, etc.) `email` | text | User's email. May be null if the provider doesn't share it. `email_verified` | timestamp | When the email was verified. Null if never verified. `image` | text | Profile picture URL from the provider. `created_at` | timestamp | When the user first signed in. `updated_at` | timestamp | Last profile sync from the provider. ### accounts This table links a user to an OAuth provider. One user can have multiple accounts (e.g., Google + GitHub). Column | Type | What it means ---|---|--- `id` | text / UUID | Primary key. `user_id` | text | Foreign key → `users.id`. `type` | text | Always `"oauth"` or `"oidc"`. `provider` | text | `"google"`, `"github"`, `"discord"`, etc. `provider_account_id` | text | The provider's unique ID for this user. `refresh_token` | text | OAuth refresh token (encrypted in production). `access_token` | text | OAuth access token (encrypted in production). `expires_at` | integer | When the access token expires (Unix timestamp). `token_type` | text | Usually `"Bearer"`. `scope` | text | Permissions granted by the provider. `id_token` | text | OIDC ID token (if using OIDC). `session_state` | text | Provider-specific session state. ### sessions Active sessions for each user. NextAuth creates a new row here on every sign-in. Column | Type | What it means ---|---|--- `id` | text / UUID | Primary key. `session_token` | text | The session token stored in the user's cookie. `user_id` | text | Foreign key → `users.id`. `expires` | timestamp | When this session expires. ### verification_tokens Short-lived tokens for email verification, password reset, etc. Self-cleaning old tokens are deleted automatically. Column | Type | What it means ---|---|--- `identifier` | text | Email or user ID the token is for. `token` | text | The actual token value. `expires` | timestamp | When this token expires. ## How they connect users ──1──1── accounts │ 1 │ ∞ sessions users ──1──∞── verification_tokens (via identifier) * One user → one or more accounts (Google, GitHub, etc.) * One user → many sessions (different devices/browsers) * Verification tokens are temporary and don't have a foreign key ## What to change * **Add a`role` column** to `users` if you need role-based access control. * **Add a`phone_number` column** to `users` if you're using SMS auth. * **Encrypt`access_token` and `refresh_token`** in production NextAuth doesn't do this by default. ## What to leave alone * Don't modify the `verification_tokens` table it's managed automatically. * Don't change the `session_token` format it's a signed JWT. * Don't add indexes to `provider_account_id` unless you're querying it directly (it's already unique). ## FAQ ### Does NextAuth store passwords? No. NextAuth is an OAuth-first library. It doesn't handle passwords. If you need email/password auth, use `next-auth/providers/credentials` with bcrypt, or use a service like Clerk or Lucia. ### How do I see what's in my NextAuth tables? Use dbdiagramr paste your connection string and get a visual schema of your NextAuth tables in seconds. ### Can I add custom fields to the users table? Yes. Add columns to the `users` table directly. NextAuth will ignore columns it doesn't know about, so you can safely add `role`, `phone_number`, `preferences`, etc. ### What happens when a user deletes their account? NextAuth doesn't cascade deletes by default. You need to manually delete from `users`, `accounts`, and `sessions`. Or add `ON DELETE CASCADE` to your foreign key constraints. ### Is Auth.js the same as NextAuth? Yes. Auth.js is the rebranded version of NextAuth. The database schema is identical. If you're on NextAuth v4, you're using the same tables.
dev.to
September 7, 2026 at 7:21 PM
Me llama la atención que DashCore incluya componentes de dashboard listos para GraphQL. ¿Tiene ya integraciones de autenticación con NextAuth o tendría que añadírselas? También, ¿el config de Tailwind está optimizado para purge? #tailwind
September 6, 2026 at 10:44 PM
I spent three days unifying identity logic across my active software projects. Two used custom NextAuth, one raw JWTs, another a third-party service. Every expired token meant pausing to remember that specific app's setup.
September 3, 2026 at 7:30 PM
I Built a Next.js Auth Boilerplate That Saves Developers Two to Four Weeks of Setup Time
Every time I started a new project, whether it was Formgrid, Sheetrocket, or a client build, the first week or two disappeared into authentication. Email verification tokens. Password reset flows. NextAuth configuration. A Prisma schema for users and sessions. Setting up the Google OAuth consent screen. Middleware for protected routes. None of that is intellectually interesting. All of it is necessary. And it has to be done correctly, because a mistake in auth isn't a bug; it's a security vulnerability with someone's real account attached to it. After doing this properly from scratch for the fifth time, I stopped. I built it once, the right way, open-sourced it, and made it the starting point for every project after this one. The result is a production-ready authentication starter kit that gets a new Next.js project from zero to working auth in minutes instead of weeks. ## What it includes **Email and password authentication with Zod validation.** Not just a signup form, proper server-side validation that catches weak passwords, duplicate emails, and malformed input before any of it reaches the database. **Email verification.** New users can't access protected routes until they verify their email, and the verification token expires after 24 hours. Without this, any email address, including ones the signer doesn't actually own, can be used to create an account. **Password reset with secure tokens.** The reset token expires after one hour. Without an expiry, a leaked reset link is a permanent vulnerability sitting in someone's inbox forever. The token itself is hashed before it's stored, so even a full database breach doesn't hand over usable reset tokens. **Google OAuth with NextAuth.js v5.** Handles the OAuth flow, stores the account link in the database, and merges correctly with an existing email account if the user originally signed up with a password. Getting that merge logic wrong is one of the most common auth bugs I've seen in real production apps. **Protected routes with Next.js middleware.** Everything under the dashboard directory is protected automatically. The middleware checks the session and redirects unauthenticated users to login before the page component ever renders; no manual auth check copied into every page. ** Role-based access.** The User model has a role field, defaulting to USER, with support for ADMIN and any other role you want to add. Middleware can gate admin-only routes without touching every protected page individually. **A responsive dashboard layout in Tailwind.** A clean starting point for the authenticated UI, so you can start building your actual feature immediately after cloning instead of also designing a dashboard shell first. ## The stack, and the honest tradeoffs **Next.js 15 with the App Router.** The current standard for React apps with server components and server actions. The App Router changes how auth is wired up compared to the Pages Router, and NextAuth v5 is built specifically for it. **Prisma with MySQL.** Type safe queries with automatic migrations. MySQL for wide hosting compatibility, easily swapped for PostgreSQL by changing one line in the Prisma schema and the DATABASE_URL. **NextAuth.js v5.** The current major version, with breaking changes from v4. The configuration pattern changed significantly, and most tutorials still floating around online use the old v4 pattern. This boilerplate uses the correct v5 approach. **Resend for transactional email.** The most developer-friendly email API I've used. It's what Formgrid runs in production for verification and notification emails. The templates in the boilerplate are plain text and easy to reskin with your own branding. **Tailwind CSS.** Utility-first styling that ships zero unused CSS to production. ## Three decisions worth explaining, because most tutorials get them wrong ### JWT sessions over database sessions NextAuth supports two session strategies. Database sessions store a session record per login and validate it against the database on every request. JWT sessions encode the session data into a signed token and validate it cryptographically, no database query required. Database sessions are more revocable; you can kill a session instantly by deleting its record. JWT sessions are faster, since there's no query on every authenticated request, but you can't invalidate one without extra infrastructure sitting on top. The boilerplate uses JWT for simplicity and speed. If your product needs immediate session revocation, for example, kicking someone out the moment their subscription lapses, that's the tradeoff worth knowing before you commit to this pattern. ### Hashing verification and reset tokens Verification tokens and password reset tokens are stored hashed in the database, never in plain text. That means even if someone reads the raw database, they can't use the stored tokens to verify accounts or reset passwords themselves. The plain text token only ever exists in the email link, and it's compared against the hash at submission time. Same principle as password hashing, applied to a temporary token instead of a permanent credential. ### Auth checks belong in middleware, not in page components Next.js middleware runs on the Edge runtime before the page ever renders. Putting the auth check there means a protected page is never rendered for an unauthenticated visitor, not even partially. Putting the check inside the page component instead means the page starts rendering and then redirects, which produces a flash of content the user was never supposed to see. Middleware is the correct place for the gate, not a convenience, but a correctness requirement. ## How to use it git clone git@github.com:allenarduino/nextjs-prisma-auth-boilerplate.git cd nextjs-prisma-auth-boilerplate npm install Copy `.env.example` to `.env` and fill in: * `DATABASE_URL`, your MySQL connection string * `NEXTAUTH_SECRET`, a random 32-character string; generate one with `openssl rand -base64 32` * `NEXTAUTH_URL`, your app's base URL * `GOOGLE_CLIENT_ID` and `GOOGLE_CLIENT_SECRET`, from the Google Cloud Console after creating an OAuth 2.0 credential * `RESEND_API_KEY`, from resend.com after creating an account and verifying a sending domain * `EMAIL_FROM`, the sender address your verification and reset emails go out from, for example `Formgrid <no-reply@yourdomain.com>` Then: npx prisma generate npx prisma db push npm run dev That's the whole setup. From clone to a working signup, verification, login, and password reset flow, in minutes. ## What to build on top of it **A SaaS product.** The auth layer is done. Add your subscription logic, your core features, and your billing integration. The User model's role field is already there to extend into a subscription tier if you need one. **A client project.** Clone it, configure the environment variables for the client's domain and database, restyle the Tailwind to match their brand, and deploy. The auth is production-ready from day one, not a prototype you'll need to harden later. **A side project.** Stop spending the first two weeks on auth and start building the part that's actually yours. The boilerplate handles the foundation so you can get to the feature that makes your project worth building in the first place. ## How this connects to Formgrid Formgrid runs a similar auth pattern, built in Express and Prisma instead of NextAuth, but the same principles apply underneath: email verification, hashed tokens, JWT sessions, Google OAuth, protected routes. Building this boilerplate was really just distilling those same patterns, ones already proven in a product real customers pay for, into a shareable starting point for the Next.js ecosystem specifically. ## Where it stands right now The repo has picked up 17 GitHub stars and 9 forks in a short amount of time, which is a decent early signal that the pain point is real and not just mine. You can browse the code at github.com/allenarduino/nextjs-prisma-auth-boilerplate or try the live demo at nextjs-prisma-auth-boilerplate.vercel.app. ## Closing Authentication is never the interesting part of a product. It's the necessary foundation everything else gets built on. Getting it right matters because getting it wrong means real security vulnerabilities attached to real users. Getting it done quickly matters because every week spent on auth is a week not spent on the feature that actually makes your product worth using. Clone the repo, configure the environment, and go build the interesting part. If you use it on a project, or find a way to improve it, I'd genuinely like to hear about it. The repo is open for contributions and issues at github.com/allenarduino/nextjs-prisma-auth-boilerplate. Reach me at allen@formgrid.dev. _I'm Allen, a full-stack TypeScript engineer and the founder of Formgrid and Sheetrocket. I write about real production engineering from products that people actually pay for. More at jonesstack.com._
dev.to
September 1, 2026 at 9:16 PM
#後で読む 用メモです→
NextAuthで動くWebサービスにExpoアプリの認証を後付けした構成と残った課題
NextAuthで動くWebサービスにExpoアプリの認証を後付けした構成と残った課題
zenn.dev
August 31, 2026 at 1:54 PM
Rebuilt my site on Next.js and wrote up the shape I ended up with rather than the migration. No NextAuth, no tRPC, no CMS, no Drizzle over Prisma, which was really one decision in different costumes: keep the surface area small.

First of 9: roland.leth.ro/blog/tech/th...

#NextJS
August 30, 2026 at 6:00 PM
Day 903 | #365DaysOfCode

• AI course progress
• Built out authentication with NextAuth
• Anki session

#100Devs #SoftwareEngineer #100DaysOfCode
August 25, 2026 at 9:26 PM
I was wrong about vibe-coding boilerplate. Letting Claude write your Next.js /api/auth/[...nextauth] means shipping validation you can't debug. If you didn't write the code, you don't own it.
August 24, 2026 at 4:40 PM
i’ve been working for a couple weeks on converting a very-annoying Next.js 16 project with NextAuth

to run on very-helpful Tanstack Start with Better-Auth

and the one thing I can tell you for sure is

Vitest makes choosing between all the different ways of mocking things VERY confusing 😵‍💫
August 20, 2026 at 12:49 PM
欲しい機能をNextAuthが実装してなくて絶望した
February 21, 2024 at 2:54 PM
CVE-2026-73420 - next-auth
NextAuth.js, a popular authentication tool for Next.js websites, had a security issue that allowed attackers to bypass email verification. This meant an attacker could trick…

Too many irrelevant or confusing CVEs? Use stackflag.com

#nextauth #nextauthjs #CVE #infosec
CVE-2026-73420: NextAuth.js: Attacker can bypass email verification with a fake address
NextAuth.js, a popular authentication tool for Next.js websites, had a security issue that allowed attackers to bypass email verification.
stackflag.com
August 13, 2026 at 11:20 PM
CVE-2026-73421 - next-auth
If you use Auth.js to control access to your website or application, a misconfigured Auth.js setup can allow anyone to access your resources. This happens when the server…

Too many irrelevant or confusing CVEs? Use stackflag.com

#nextauth #nextauthjs #npm #CVE #infosec
CVE-2026-73421: Auth.js: Server errors cause unsecured access to all resources
If you use Auth.js to control access to your website or application, a misconfigured Auth.js setup can allow anyone to access your resources.
stackflag.com
August 13, 2026 at 10:20 PM
🧪 Fought Jest + NextAuth mocking for an hour. `ECONNREFUSED` despite `jest.mock()`.

Fix: `jest.resetModules()` + dynamic `require()` in `beforeEach`. Forces fresh module loading so mocks actually work.

Coming from Spring Boot's `@MockUser`, surprised this isn't documented.

#NextJS #Jest #Testing
December 11, 2025 at 2:01 PM
多租户认证框架的选择:Better-auth、Nextauth还是其他方案?

https://qian.cx/posts/56D0FD9F-9EFE-4C6C-ABA3-7AB376E2C8F3
September 28, 2025 at 12:41 PM
@privateger so something like nextauth on the front and just validate the token on the back?
February 12, 2025 at 2:38 AM
eu te odeio NextAuth
eu te odeio!
February 23, 2025 at 1:23 PM
There are many tools you can use to build a full-stack application. And this course will teach you some popular options while you build your own dating app. You'll use Next.js, Prisma, NextAuth, and Cloudinary to build the app & Vercel to deploy it.
www.freecodecamp.org/news/build-d...
September 7, 2025 at 4:01 AM
There are many tools you can use to build a full-stack application. And this course will teach you some popular options while you build your own dating app. You'll use Next.js, Prisma, NextAuth, and Cloudinary to build the app & Vercel to deploy it.
www.freecodecamp.org/news/build-d...
June 10, 2025 at 4:07 PM
NextAuth v5 はbetaや、まだissueいっぱいやで言われた。お恥ずかしながら忘れてた…

next.js - Unable to Redirect After Credential Authentication on Custom Sign-In Page with NextAuth - Stack Overflow
Unable to Redirect After Credential Authentication on Custom Sign-In Page with NextAuth
Next.js 15.0.1 NextAuth 5.0.0-beta I'm using NextAuth (v5). I have set up a form on the /signin page where users enter their email and password, then click the submit button to sign in. The sign-in
buff.ly
February 27, 2025 at 12:24 AM
NextAuthでcredentialのカスタムページにして、こういう感じなんですが。認証後にリダイレクトしてくれないのは何でなんですか。signInにリダイレクト先指定、指定なしならルートに遷移する認識なのですが
February 26, 2025 at 2:05 AM
前言ってたNextAuthのsignIn動かない問題、OAuthだとそれで正しいっぽい。メール認証のときだけ使うみたい。公式ドキュメントにははっきり書かれてないけど、状況とか断片から読み解くときっとそうだ…
February 21, 2025 at 12:28 AM