NextAuth configuration exporting auth options with Google provider and Prisma adapter.
// Source: https://github.com/benlamiro/ShipGenAI | License: MIT | Copyright 2023 Anil Chandra Naidu Matcha
// Provided via justclaw.it.com; keep this notice with the code.
import { PrismaAdapter } from "@next-auth/prisma-adapter";
import GoogleProvider from "next-auth/providers/google";
import { prisma } from "./prisma";
export const authOptions = {
adapter: PrismaAdapter(prisma),
providers: [
GoogleProvider({
clientId: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
}),
],
callbacks: {
async session({ session, user }) {
if (session.user) {
session.user.id = user.id;
session.user.credits = user.credits;
}
return session;
},
},
secret: process.env.NEXTAUTH_SECRET,
pages: {
signIn:
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key