Invalid Compact JWE
Unanswered
Sphynx posted this in #help-forum
SphynxOP
Hi, I'm following this template (https://github.com/vercel/nextjs-planetscale-nextauth-tailwindcss-template), using a mongodb provider, but I'm getting this error all the time when I try to sign in, and even though I can see my account, sessions and stuff in the db, I can see them logged when I active debug: true, but I'm never "signed in", and i'm getting this error..
I really don't know what to do now.
I really don't know what to do now.
1 Reply
SphynxOP
export const authOptions: NextAuthOptions = {
jwt: {
secret: process.env.NEXTAUTH_SECRET as string,
},
adapter: MongoDBAdapter(clientPromise, {
collections: {
Accounts: 'webaccounts',
Sessions: 'websessions',
Users: 'webusers',
VerificationTokens: 'webverificationtokens',
},
databaseName: 'webauth',
}) as Adapter,
providers: [
GithubProvider({
clientId: process.env.GITHUB_ID as string,
clientSecret: process.env.GITHUB_SECRET as string,
}),
],
session: {
strategy: 'jwt', //'database' will give me Invalid JWE
}
};I figured out that, when putting "database" as a strategy, I get this error, but when I check the websessions collection, I can see a session document with a sessionToken..
Should I just stick to jwt then ? and not saving them in db ?