next-auth icon indicating copy to clipboard operation
next-auth copied to clipboard

PKCE code_verifier cookie was missing in development

Open trevorpfiz opened this issue 1 year ago • 14 comments

Environment

System: OS: Linux 5.15 Ubuntu 20.04.6 LTS (Focal Fossa) CPU: (16) x64 AMD Ryzen 7 3700X 8-Core Processor Memory: 7.12 GB / 9.72 GB Container: Yes Shell: 5.8 - /usr/bin/zsh Binaries: Node: 20.11.0 - ~/.nvm/versions/node/v20.11.0/bin/node npm: 10.2.4 - ~/.nvm/versions/node/v20.11.0/bin/npm pnpm: 8.15.1 - ~/.local/share/pnpm/pnpm bun: 1.0.14 - ~/.local/share/pnpm/bun Watchman: 2024.01.22.00 - /home/linuxbrew/.linuxbrew/bin/watchman

Reproduction URL

https://github.com/trevorpfiz/create-t3-turbo/tree/main

Describe the issue

adding pkceCodeVerifier cookie gives error PKCE code_verifier cookie was missing when using Google or Discord providers in development.

How to reproduce

add

pkceCodeVerifier: {
    name: 'next-auth.pkce.code_verifier',
    options: {
      httpOnly: true,
      sameSite: 'none',
      path: '/',
      secure: process.env.NODE_ENV === 'production',
    },
  },

see error when trying to login in during development with Discord or Google.

Expected behavior

I would expect no error like in production.

trevorpfiz avatar Feb 10 '24 22:02 trevorpfiz

I have the same problem but to authenticate on my subdomains

Link teste

marlon307 avatar Feb 17 '24 01:02 marlon307

Same problem with Auth0 provider.

leo3linbeck avatar Feb 17 '24 23:02 leo3linbeck

Is there any update on this?

Edit by maintainer bot: Comment was automatically minimized because it was considered unhelpful. (If you think this was by mistake, let us know). Please only comment if it adds context to the issue. If you want to express that you have the same problem, use the upvote 👍 on the issue description or subscribe to the issue for updates. Thanks!

daved-gowithhero avatar Mar 21 '24 14:03 daved-gowithhero

same problem with google provider nextauth v5

DuanTranHuy avatar Apr 22 '24 02:04 DuanTranHuy

same problem with github provider nextauth v5

ChainCoderX avatar Apr 22 '24 09:04 ChainCoderX

Same problem with github provider and google provider on next-auth": "5.0.0-beta.17". Has anyone found a solution?

serethomas avatar May 01 '24 22:05 serethomas

I am using github provider and followed the documentation as it is and facing the exact same issue!

DeepaPrasanna avatar May 17 '24 05:05 DeepaPrasanna

I have the same problem. Any fixes?

Edit by maintainer bot: Comment was automatically minimized because it was considered unhelpful. (If you think this was by mistake, let us know). Please only comment if it adds context to the issue. If you want to express that you have the same problem, use the upvote 👍 on the issue description or subscribe to the issue for updates. Thanks!

zhefciad avatar May 17 '24 12:05 zhefciad

I have the same problem. Any fixes?

Edit by maintainer bot: Comment was automatically minimized because it was considered unhelpful. (If you think this was by mistake, let us know). Please only comment if it adds context to the issue. If you want to express that you have the same problem, use the upvote 👍 on the issue description or subscribe to the issue for updates. Thanks!

i have switched to supabase auth

DeepaPrasanna avatar May 17 '24 12:05 DeepaPrasanna

remove cookies from the browser. that fixed it for me.

jonoise avatar May 20 '24 01:05 jonoise

I'm also getting the same error, I'm using OAuth and google provider

image

yeasin2002 avatar May 20 '24 19:05 yeasin2002

I fixed my problem by changing NEXTAUTH_URL in env.local from 127.0.0.1 to localhost.

zhefciad avatar May 22 '24 20:05 zhefciad

remove cookies from the browser. that fixed it for me.

THANK YOUUUUUUUU

pedrobando avatar Jun 02 '24 01:06 pedrobando

@trevorpfiz did you figure this one out? And if not, can I see your DiscordProvider config?

itschip avatar Jun 24 '24 17:06 itschip

@trevorpfiz did you figure this one out? And if not, can I see your DiscordProvider config?

no. this? https://github.com/MithridHealth/create-t3-turbo/blob/d20d8625f9579e7c90e154d866e7425e48f5a8d1/packages/auth/src/index.ts#L32

trevorpfiz avatar Jul 05 '24 19:07 trevorpfiz