Better AuthBA
Better Auth11mo ago
7 replies
Lightning Fryer

Better Auth returns an error on google social sign in of a State Mismatch

So I tried to implement google OAuth using better-auth in nextjs using mysql as the database (with connection pooling) and I was able to generate and migrate the schema but when I made the auth client and tried to sign in through google it takes me to the OAuth consent screen but after I give the permissions it returns to a Better Auth Error page.

The error code in the console is: ERROR [Better Auth]: State Mismatch. Verification not found { state: 'undefined' }

I am unsure what this means but I did check and confirm that the verification table does indeed exist within the schema properly.
image.png
Solution
Fortunately I fixed the problem, the problem was in the connection pool for mysql2 I had passed the option to return the rows as an array instead of json
Was this page helpful?