Google OAuth used in Vercel production got failed to authenticate
Hi, I am currently using this repo: https://github.com/get-convex/convex-nextauth-template to implement Google OAuth instead of Github for my application. When i test it in localhost, it works really fine. But when i deploy it to Vercel in production, I got this error: Failed to authenticate: "Could not verify token claim", check your server auth config, and this leads to all the Uncaught Error: Not authenticated errors in Convex. The data of user is still created in the users and accounts table, as well as a new session is created to the sessions tables. How can i solve this?
Thank you
GitHub
GitHub - get-convex/convex-nextauth-template: Example of using Auth...
Example of using Auth.js (NextAuth) with Convex. Contribute to get-convex/convex-nextauth-template development by creating an account on GitHub.
2 Replies
@hugo this might be helpful to follow:
https://docs.convex.dev/auth/debug
Based on the errors, I'd assume one of the environment variables is not configured correctly.
Debugging Authentication | Convex Developer Hub
You have followed one of our authentication guides but something is not working.
Specifically these ones: https://stack.convex.dev/nextauth-adapter#environment-variables
(you have to do this separately for your prod deployment)
Stack
Convex Adapter for Auth.js (NextAuth) Setup Guide
Learn how to install and configure the Convex adapter for Auth.js as part of getting set up with Convex and Next.js.