Next.js Discord

Discord Forum

Next Auth, State Cookie Was Missing error

Unanswered
Sloth bear posted this in #help-forum
Open in Discord
Sloth bearOP
I have an error in next-auth, when i log in in my website, this error occurs in my terminal :
[next-auth][error][OAUTH_CALLBACK_ERROR]
https://next-auth.js.org/errors#oauth_callback_error State cookie was missing. {
  error: TypeError: State cookie was missing.
      at Object.use (webpack-internal:///(rsc)/./node_modules/next-auth/core/lib/oauth/checks.js:126:27)
      at oAuthCallback (webpack-internal:///(rsc)/./node_modules/next-auth/core/lib/oauth/callback.js:98:29)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async Object.callback (webpack-internal:///(rsc)/./node_modules/next-auth/core/routes/callback.js:18:79)
      at async AuthHandler (webpack-internal:///(rsc)/./node_modules/next-auth/core/index.js:202:38)
      at async NextAuthRouteHandler (webpack-internal:///(rsc)/./node_modules/next-auth/next/index.js:50:30)
      at async NextAuth._args$ (webpack-internal:///(rsc)/./node_modules/next-auth/next/index.js:85:24)
      at async D:\recipe-rush\reciperush\node_modules\next\dist\compiled\next-server\app-route.runtime.dev.js:6:62609 {
    name: 'OAuthCallbackError',
    code: undefined
  },
  providerId: 'google',
  message: 'State cookie was missing.'
}
my Dependencies are updated to the latest update, client ID and client secret is 100% correct and matches the credentials in google console, but i'm not sure of the callback URL , Heres the code :
 providers: [
        GoogleProvider({
            clientId: process.env.GOOGLE_CLIENT_ID,
            clientSecret: process.env.GOOGLE_CLIENT_SECRET,
            callbackUrl: process.env.NEXTAUTH_URL + "/api/auth/callback/google"
        }),
]
})
what is the error here ? .env :
NEXTAUTH_SECRET=wbU7GMqWkGjwl2AmY1S8MjqC/AQdiOuGDQYJJm/gLh8=
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_URL_INTERNAL=http://10.240.8.16


thank you!

0 Replies