0

Developing a next.js application that uses next-auth for authentication. It is currently setup with GitHub as the only Provider.

In development, the authentication works just fine.

In production, after I click "Sign in with GitHub", I am directed to a 404.

I'm 99% sure this has to do with the callback URL I have setup in my GitHub OAuth app. For dev purposes it is set to http://localhost:3000/api/auth/callback/github. Obviously this is no good for a deployed app, but I don't know what to set it to. I've tried a couple of different URL's with no luck.

Other than the callback URL is there anything else I need to set up in my code to get this working in production?

1 Answers1

0

Other than the callback URL, this is from the docs:

https://next-auth.js.org/getting-started/example#deploying-to-production

When deploying your site set the NEXTAUTH_URL environment variable to the canonical URL of the website.

NEXTAUTH_URL=https://example.com

You should set this as a production environment variable on the Vercel dashboard to link to the URL where Vercel deployed your site.

antosan
  • 36
  • 3