Skip to content

Official website demo couldn't signin with apple #12880

Closed
@georgezouq

Description

@georgezouq

Provider type

Apple

Environment

System:
    OS: macOS 15.3.2
    CPU: (14) arm64 Apple M4 Pro
    Memory: 765.44 MB / 48.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.20.7 - ~/.nvm/versions/node/v18.20.7/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v18.20.7/bin/yarn
    npm: 10.8.2 - ~/.nvm/versions/node/v18.20.7/bin/npm
    pnpm: 9.2.0 - ~/Library/pnpm/pnpm
    bun: 1.2.5 - ~/.bun/bin/bun
  Browsers:
    Chrome: 135.0.7049.95
    Safari: 18.3.1

Reproduction URL

https://next-auth-example.vercel.app/auth/signin?callbackUrl=https%3A%2F%2Fnext-auth-example.vercel.app%2F

Describe the issue

On my nextjs project, I have "PKCE code_verifier cookie missing" problem use apple provide, and I find official demo in next-auth website still couldn't signin with apple!

In my local, it report an error:

error: TypeError: PKCE code_verifier cookie was missing.
at Object.use (/Users/georgezou/Documents/WORK/StaringAI/mtbird-saas/node_modules/next-auth/core/lib/oauth/checks.js:60:30)
at oAuthCallback (/Users/georgezou/Documents/WORK/StaringAI/mtbird-saas/node_modules/next-auth/core/lib/oauth/callback.js:75:24)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.callback (/Users/georgezou/Documents/WORK/StaringAI/mtbird-saas/node_modules/next-auth/core/routes/callback.js:45:11)
at async AuthHandler (/Users/georgezou/Documents/WORK/StaringAI/mtbird-saas/node_modules/next-auth/core/index.js:260:28)
at async NextAuthApiHandler (/Users/georgezou/Documents/WORK/StaringAI/mtbird-saas/node_modules/next-auth/next/index.js:18:19)
at async auth (webpack-internal:///(api)/./src/pages/api/auth/next/[...nextauth].ts:26:12)
at async Object.apiResolver (/Users/georgezou/Documents/WORK/StaringAI/mtbird-saas/node_modules/next/dist/server/api-utils/node.js:366:9)
at async DevServer.runApi (/Users/georgezou/Documents/WORK/StaringAI/mtbird-saas/node_modules/next/dist/server/next-server.js:481:9)
at async Object.fn (/Users/georgezou/Documents/WORK/StaringAI/mtbird-saas/node_modules/next/dist/server/next-server.js:741:37) {
name: 'OAuthCallbackError',
code: undefined
},
providerId: 'apple'
}

And I add or remove cookies blow what this issues said, it doesn't work

pkceCodeVerifier: {
            name: `${COOKIE_PREFIX}next-auth.pkce.code_verifier`,
            options: {
              httpOnly: true,
              sameSite: 'lax',
              path: '/',
              secure: true,
              maxAge: COOKIES_LIFE_TIME,
            },
          },

How to reproduce

open https://next-auth-example.vercel.app/ -> click Sign In button -> click Apple
I got this error

Expected behavior

signin,,,,

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinginvalid reproductionThe issue did not have a detectable valid reproduction URLproviderstriageUnseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions