#NextAuth problem in Vercel

1 messages · Page 1 of 1 (latest)

olive pewterBOT
#

Hi @mental kiln. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

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:

  1. Make sure to set the Authorization Callback URL as your deployment’s URL followed by /api/github-oauth on GitHub. This can be found in your GitHub OAuth app settings. source (https://vercel.com/templates/next.js/virtual-event-starter-kit)

  2. Set NEXT_PUBLIC_GITHUB_OAUTH_CLIENT_ID and GITHUB_OAUTH_CLIENT_SECRET on Vercel Project Environment Variables Settings for the production environment. source (https://vercel.com/templates/next.js/virtual-event-starter-kit)

  3. Edit SITE_URL in lib/constants.ts to match your deployment’s URL (no trailing slash). source (https://vercel.com/templates/next.js/virtual-event-starter-kit)

  4. Push the code to redeploy the Project on Vercel. source (https://vercel.com/templates/next.js/virtual-event-starter-kit)

  5. If you're using other environment variables like GITHUB_ID, GITHUB_SECRET, NEXTAUTH_URL, and SECRET, make sure to set them correctly in your Vercel environment settings. source (https://vercel.com/guides/nextjs-prisma-postgres)

  6. 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)