Next.js Discord

Discord Forum

NextAuth session not saving

Unanswered
Britannia Petite posted this in #help-forum
Open in Discord
Original message was deleted.

3 Replies

Britannia Petite
If anyone's able to help, please do.
import NextAuth from "next-auth"
import { MongoDBAdapter } from "@next-auth/mongodb-adapter";
import clientPromise from "@/lib/mongoDBadapter"

export const authOptions = {
  adapter: MongoDBAdapter(clientPromise, {
    databaseName: "GameSync"
  }),
  
  providers: [
     ...
  ],
  callbacks: ...,
}

const handler = NextAuth(authOptions)

export { handler as GET, handler as POST }
No connection errors to mongo in the console either.