#NextAuth problem in Vercel
1 messages · Page 1 of 1 (latest)
Hmm, I don't know enough to give you a confident answer yet. However, based on the information provided, it seems like you might be having issues with environment variables or callback URLs when deploying your Next.js application with NextAuth on Vercel.
Here are some general steps you can follow:
-
Make sure to set the Authorization Callback URL as your deployment’s URL followed by
/api/github-oauthon GitHub. This can be found in your GitHub OAuth app settings. source (https://vercel.com/templates/next.js/virtual-event-starter-kit) -
Set
NEXT_PUBLIC_GITHUB_OAUTH_CLIENT_IDandGITHUB_OAUTH_CLIENT_SECRETon Vercel Project Environment Variables Settings for the production environment. source (https://vercel.com/templates/next.js/virtual-event-starter-kit) -
Edit
SITE_URLinlib/constants.tsto match your deployment’s URL (no trailing slash). source (https://vercel.com/templates/next.js/virtual-event-starter-kit) -
Push the code to redeploy the Project on Vercel. source (https://vercel.com/templates/next.js/virtual-event-starter-kit)
-
If you're using other environment variables like
GITHUB_ID,GITHUB_SECRET,NEXTAUTH_URL, andSECRET, make sure to set them correctly in your Vercel environment settings. source (https://vercel.com/guides/nextjs-prisma-postgres) -
If you're using a Postgres database with Vercel, make sure to link your Vercel postgres database to this Vercel project so that all your database environment variables are automatically added. source (https://vercel.com/guides/nextjs-prisma-postgres)
Remember, when you import your project on Vercel, make sure to click on Environment Variables and set them to match your .env.local file. source (https://vercel.com/templates/next.js/isr-blog-nextjs-wordpress)