while importing AdapterUser from next-auth/adapters showing module not found and its type declaration i tried almost all possible ways to resolve it.
import { getServerSession } from "next-auth/next";
import { NextAuthOptions, User } from "next-auth";
import { AdapterUser } from "next-auth/adapters";
import GoogleProvider from "next-auth/providers/google";
import jsonwebtoken from "jsonwebtoken";
import { JWT } from "next-auth/jwt";
import { SessionInterface } from "@/common.types";
export const authOptions: NextAuthOptions = {
providers: [
GoogleProvider({
clientId: process.env.GOOGLE_CLIENT_ID!,
clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
}),
],
// jwt: {
// encode: ({ secret, token }) => {},
// decode: async ({ secret, token }) => {},
// },
// theme: {
// colorScheme: "light",
// logo: "/logo.png",
// },
callbacks: {
async session({ session }) {
return session;
},
async signIn({ user }: { user: AdapterUser | User }) {
try {
// get the user if they exist
/// if not create a new user
///return true if they exist or logged in
return true;
} catch (error: any) {
console.log(error);
return false;
}
},
},
};
while importing AdapterUser from next-auth/adapters showing module not found and its type declaration i tried almost all possible ways to resolve it.
import { getServerSession } from "next-auth/next"; import { NextAuthOptions, User } from "next-auth"; import { AdapterUser } from "next-auth/adapters"; import GoogleProvider from "next-auth/providers/google"; import jsonwebtoken from "jsonwebtoken"; import { JWT } from "next-auth/jwt"; import { SessionInterface } from "@/common.types";
export const authOptions: NextAuthOptions = { providers: [ GoogleProvider({ clientId: process.env.GOOGLE_CLIENT_ID!, clientSecret: process.env.GOOGLE_CLIENT_SECRET!, }), ], // jwt: { // encode: ({ secret, token }) => {}, // decode: async ({ secret, token }) => {}, // }, // theme: { // colorScheme: "light", // logo: "/logo.png", // }, callbacks: { async session({ session }) { return session; }, async signIn({ user }: { user: AdapterUser | User }) { try { // get the user if they exist /// if not create a new user ///return true if they exist or logged in return true; } catch (error: any) { console.log(error); return false; } }, }, };