Custom Prisma adapter for NextAuth with Gmail normalization and token fixes.
// Source: https://github.com/velobase/velobase-harness | License: MIT | Copyright 2026 Velobase
// Provided via justclaw.it.com; keep this notice with the code.
import { PrismaAdapter } from "@auth/prisma-adapter";
import type { PrismaClient, User } from "@prisma/client";
import type { Adapter, AdapterUser } from "next-auth/adapters";
import { normalizeEmail, isGmailAddress } from "./normalize-email";
import { SIGNUP_DISABLED } from "@/config/decommission";
declare module "next-auth/adapters" {
interface AdapterUser {
isPrimaryDeviceAccount?: boolean | null;
}
}
/** Prisma User -> AdapterUser */
function toAdapterUser(user: User): AdapterUser {
return {
id: user.id,
name: user.name,
email: user.email ?? "",
emailVerified: user.emailVerified,
image: user.ima
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key