Next.js Discord

Discord Forum

"Error: This action with HTTP GET is not supported by NextAuth.js" in NextAuth.

Unanswered
Alligator mississippiensis posted this in #help-forum
Open in Discord
Alligator mississippiensisOP
Hello, I keep getting "Error: This action with HTTP GET is not supported by NextAuth.js" in NextAuth.

2 Replies

Can you show a code snippet, or the full error
Alligator mississippiensisOP
routes.ts:
import NextAuth from "next-auth";
import Auth0Provider from "next-auth/providers/auth0";
import type { NextAuthOptions } from "next-auth";

export const authOptions: NextAuthOptions = ({
  providers: [
    Auth0Provider({
      clientId: process.env.AUTH0_CLIENT_ID ?? "",
      clientSecret: process.env.AUTH0_SECRET ?? "",
      issuer: process.env.AUTH0_ISSUER_BASE_URL
    }),
  ],
  secret: process.env.JWT_SECRET,
  pages: {
    signIn: "/api/auth/sigIn",
    signUp: "/api/auth/signUp",
    signOut: "/api/auth/signOut"
  },
  session: {
    strategy: 'jwt',
    maxAge: 30 * 24 * 60 * 60, // Set session lifetime to 30 days
  },
});

const handler = NextAuth(authOptions)

export { handler as GET, handler as POST }