Need help in resolving 'Invalid Compact JWE' error in Next Auth #8626
-
I am trying to make next auth work with Neon's postgres database using Prisma and include Google's OAuth. So far i have done everything, and all the data of the user is successfully being stored in the database. But when trying to fetch the data using
So far i only found one thread regarding this here, where although the error is same the stack is different. And the solution proposed in it, which was to clear cookies, did not work. Here's my next-auth api file: import NextAuth from "next-auth";
import GoogleProvider from "next-auth/providers/google";
import {env} from "@/env";
import { PrismaAdapter } from "@auth/prisma-adapter";
import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient();
const authOptions = {
adapter: PrismaAdapter(prisma),
providers: [
GoogleProvider({
clientId: env.GOOGLE_CLIENT_ID,
clientSecret: env.GOOGLE_CLIENT_SECRET
}),
],
secret: env.NEXTAUTH_SECRET,
strategy: "jwt",
}
const handler = NextAuth(authOptions);
export { handler as GET, handler as POST }; Also i am only getting this error with |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
@ChiragAgg5k You can try this one: |
Beta Was this translation helpful? Give feedback.
-
i have solved this problem try like this |
Beta Was this translation helpful? Give feedback.
-
i had the same problem and it worked when i supplied authOptions. but, error [next-auth][error][JWT_SESSION_ERROR] still presists. |
Beta Was this translation helpful? Give feedback.
@ChiragAgg5k You can try this one:
const session = await getServerSession(authConfigs);