Lichess.org PKCE gives oauth_code_verification_failed

Can you help me debug this issue? I'm trying to link an account to lichess.org via OAuth with PKCE using a genericOAuth provider but I keep getting this error oauth_code_verification_failed on better-auth. SETUP This is an example repo of the setup I have https://github.com/bianc8/better-auth-lichess I'm trying to recreate the official lichess example with a monorepo with Next.js (use only better-auth client) + Express (used as better-auth server) Here I've setup an example repo using better-t-stack, and I've added the genericOAuth plugin on the server & client, in addition to the emailAndPassword login. * auth server is an express backend (port 3000) github link * auth client definition (port 3001) * auth client oauth2.link on next.js github link FLOW After a successfull signin via email&pwd on the frontend, I access the /dashboard page and I link the generic oauth2 provider for lichess.org to my account; after I authorize the scopes on lichess, I return back on the express server (port 3000) but on the frontend I see Error Code: oauth_code_verification_failed as the image attached and on the backend terminal I see just this (even tho logger level is set to debug)
{TIMESTAMP} ERROR [Better Auth]: { status: 404, statusText: 'Not Found' }
{TIMESTAMP} ERROR [Better Auth]: { status: 404, statusText: 'Not Found' }
To test this you just need to update .env vars with postgres DATABASE_URL, sync prisma schema to db & ur good to go.
No description
1 Reply
Ping
Ping3mo ago
Hello, I believe this is occurring when the token endpoint returns not found

Did you find this page helpful?