Server error while authenticating with github on vercel domain
Answered
QBit posted this in #help-forum
QBitOP
When I sign up with github on localhost, I was able to sign in. When I deployed the app and sign up with github (on vercel domain https://leetcode-virtual-whiteboard.vercel.app/sign-up) it is showing
I have separate OAuth application in github for localhost and vercel, shown in image:
I can I resolve this error?
Server error
There is a problem with the server configuration.
Check the server logs for more information.I have separate OAuth application in github for localhost and vercel, shown in image:
I can I resolve this error?
Answered by joulev
it is used to "hash tokens, sign/encrypt cookies and generate cryptographic keys", basically it does lots of things
16 Replies
QBitOP
I also entered the secret key and github ID in the environment variables on vercel project
logs [next-auth][error][NO_SECRET]
https://next-auth.js.org/errors#no_secret Please define a `secret` in production. r [MissingSecretError]: Please define a `secret` in production.
at t.assertConfig (/var/task/.next/server/app/api/auth/[...nextauth]/route.js:6:107513)
at _ (/var/task/.next/server/app/api/auth/[...nextauth]/route.js:6:100878)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async a (/var/task/.next/server/app/api/auth/[...nextauth]/route.js:30:19579)
at async e.length.t (/var/task/.next/server/app/api/auth/[...nextauth]/route.js:30:20990)
at async /var/task/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:34666
at async eS.execute (/var/task/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:25813)
at async eS.handle (/var/task/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:35920)
at async es (/var/task/node_modules/next/dist/compiled/next-server/server.runtime.prod.js:16:25461)
at async ei.responseCache.get.routeKind (/var/task/node_modules/next/dist/compiled/next-server/server.runtime.prod.js:17:1026) {
code: 'NO_SECRET'
}app/api/auth/[...nextauth]/route.tsximport NextAuth from "next-auth"
import GitHubProvider from "next-auth/providers/github"
const handler = NextAuth({
providers: [
GitHubProvider({
clientId: process.env.GITHUB_ID!,
clientSecret: process.env.GITHUB_SECRET!,
}),
],
})
export { handler as GET, handler as POST }@QBit `logs`
[next-auth][error][NO_SECRET]
https://next-auth.js.org/errors#no_secret Please define a `secret` in production. r [MissingSecretError]: Please define a `secret` in production.
at t.assertConfig (/var/task/.next/server/app/api/auth/[...nextauth]/route.js:6:107513)
at _ (/var/task/.next/server/app/api/auth/[...nextauth]/route.js:6:100878)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async a (/var/task/.next/server/app/api/auth/[...nextauth]/route.js:30:19579)
at async e.length.t (/var/task/.next/server/app/api/auth/[...nextauth]/route.js:30:20990)
at async /var/task/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:34666
at async eS.execute (/var/task/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:25813)
at async eS.handle (/var/task/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:35920)
at async es (/var/task/node_modules/next/dist/compiled/next-server/server.runtime.prod.js:16:25461)
at async ei.responseCache.get.routeKind (/var/task/node_modules/next/dist/compiled/next-server/server.runtime.prod.js:17:1026) {
code: 'NO_SECRET'
}
the error says
[next-auth][error][NO_SECRET]
https://next-auth.js.org/errors#no_secret Please define asecretin production. r [MissingSecretError]: Please define asecretin production.
@QBit Click to see attachment
QBitOP
@joulev I already defined the
secret. See here?@QBit <@484037068239142956> I already defined the `secret`. See here?
that's the github app secret, which is not the same one as the next auth secret (
NEXTAUTH_SECRET)@joulev that's the github app secret, which is not the same one as the next auth secret (`NEXTAUTH_SECRET`)
QBitOP
Sorry but do I need to put random string?
@QBit Sorry but do I need to put random string?
yep. generate a random string and use it
QBitOP
okay
@QBit what it encrypts?
it is used to "hash tokens, sign/encrypt cookies and generate cryptographic keys", basically it does lots of things
Answer
QBitOP
cool, thanks!!