Im working on a Nextjs Project 15.0.3.
Using next-auth.js for Authentication.While setting up my app/api/auth/[...nextauth].ts
page ,
I am getting the following ERROR:
Module '"next-auth"' has no exported member 'AuthOptions'. Did you mean to use 'import AuthOptions from "next-auth"' instead?
Binding element 'user' implicitly has an 'any' type.
Binding element 'account' implicitly has an 'any' type.
Binding element 'profile' implicitly has an 'any' type.
This seems to be a issue of Typescript incompactibility.
Attaching my […nextauth.ts] code:
import NextAuth from "next-auth";
import GoogleProvider from "next-auth/providers/google";
export const authOptions = {
providers :
[
GoogleProvider({clientId : process.env.GOOGLE_CLIENT_ID , clientSecret : process.env.GOOGLE_CLIENT_SECRET}),
],
callbacks :{
async signIn({ user, account, profile }
{ return true; },
async redirect({ url, baseUrl }
{ return "/details" }
},
};
const handler = NextAuth(authOptions);
export {handler as GET , handler as POST};
Tried importing Type {AuthOptions}from nextauth.
But error still persists.
Also defined Types of SignIn and redirect as Promise<Boolean>
and .Promise` respectively
Joe George is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1