#[next-auth][warn][NO_SECRET]

9 messages · Page 1 of 1 (latest)

viscid berry
#

Hello,
I'm using next-auth to make custom authentication with custom credentials, the authentication works fine but I got this warning on the console:

[next-auth][warn][NEXTAUTH_URL] 
https://next-auth.js.org/warnings#nextauth_url
[next-auth][warn][NO_SECRET]
https://next-auth.js.org/warnings#no_secret
[next-auth][error][JWT_SESSION_ERROR] 
https://next-auth.js.org/errors#jwt_session_error decryption operation failed {
  message: 'decryption operation failed',
  stack: 'JWEDecryptionFailed: decryption operation failed\n' +
    '    at gcmDecrypt (webpack-internal:///(rsc)/./node_modules/jose/dist/node/cjs/runtime/decrypt.js:68:15)\n' +
    '    at decrypt (webpack-internal:///(rsc)/./node_modules/jose/dist/node/cjs/runtime/decrypt.js:91:20)\n' +
    '    at async jwtDecrypt (webpack-internal:///(rsc)/./node_modules/jose/dist/node/cjs/jwt/decrypt.js:10:23)\n' + 
    '    at async Object.decode (webpack-internal:///(rsc)/./node_modules/next-auth/jwt/index.js:44:25)\n' +
    '    at async Object.session (webpack-internal:///(rsc)/./node_modules/next-auth/core/routes/session.js:25:34)\n' +
    '    at async AuthHandler (webpack-internal:///(rsc)/./node_modules/next-auth/core/index.js:161:37)\n' +
    '    at async getServerSession (webpack-internal:///(rsc)/./node_modules/next-auth/next/index.js:126:21)\n' +    
    '    at async page (webpack-internal:///(rsc)/./src/app/(admin)/login/page.tsx:20:21)',
  name: 'JWEDecryptionFailed'
}

In the .env file I have:

NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="my-secret"
tawdry meadowBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

stiff pagoda
viscid berry
#

I already have it.

export const authOptions: AuthOptions = {
    session: {
        strategy: strategy,
    },
    providers: [
        CredentialsProvider({
            name: 'Credintials',
            credentials: {
                username: {},
                password: {},
            },
            authorize: async (credentials, req) => {
               // auth logic
            },
        },
        )
    ],
    secret: process.env.NEXTAUTH_SECRET,
    pages: {
        signIn: '/login',
    }
}

export const handler = NextAuth(authOptions)

export { handler as GET, handler as POST }
stiff pagoda
#

try delete your cookies

#

on the browser

viscid berry
#

Ok this solves it

#

Thanks ❤️

tawdry meadowBOT
#
✅ Success!

This question has been marked as answered! If you have any other questions, feel free to create another post

Jump to answer

[Click here](#1190652672924205139 message)