Next.js Discord

Discord Forum

next-auth callback stop working when adding an adaptor?

Unanswered
Da_v_id posted this in #help-forum
Open in Discord
Hi,
when I add an adaptor, the callback from my sign-in page seems "disabled", hence it loops the signin page the code:
const client = new MongoClient(process.env.MONGODB_URL as string);
const clientPromise = client.connect();

export const options: NextAuthOptions = {
  // TODO: This adapter "disables" the callback.
  //https://github.com/nextauthjs/next-auth/issues/9493#issuecomment-1872580831
  // adapter: MongoDBAdapter(
  //   clientPromise,
  //   {
  //     collections: {
  //       Users: "user",
  //       Sessions: "sessions",
  //       VerificationTokens: "verificationTokens",
  //       Accounts: "accounts",
  //     },
  //     databaseName: "comp308_Auth",
  //   }
  // ) as Adapter,
  providers: [
    GoogleProvider({
      profile: (profile: GoogleProfile) => {
        console.log("loggin with google");
        console.log(profile);
        return {
          ...profile,
          id: profile.sub,
        }
      },
      clientId: process.env.GOOGLE_CLIENT_ID as string,
      clientSecret: process.env.GOOGLE_CLIENT_SECRET as string,
    },
    )
  ],

}

0 Replies