Next.js Discord

Discord Forum

Next auth problem

Unanswered
Iridescent shark posted this in #help-forum
Open in Discord
Iridescent sharkOP
I'm building simple authentication with next-auth. I added default options
export const options: NextAuthOptions = {
  // Configure one or more authentication providers
  adapter: PrismaAdapter(db),
  providers: [
    GoogleProvider({
      clientId: process.env.GOOGLE_ID as string,
      clientSecret: process.env.GOOGLE_SECRET as string,
    }),
  ],
};

and middleware to secure every route
export { default } from "next-auth/middleware";

The problem is that after I sign in with google, I'm getting navigated back to sign in page and can't open any other page. I can see cookie in the dev tools.
If I turn off middleware I can't get user session in the API route. It's null. What the reason of it?

1 Reply

Iridescent sharkOP
/close