-
Provider typeGitHub EnvironmentDeployed to Vercel, using Firefox as a browser.
Reproduction URLhttps://next-auth-login-example.vercel.app/api/auth/signin Describe the issueClicking the button on the sign in form does not sign me in, instead it says this: How to reproduceClick the button on the sign in form. Expected behaviorI expect to be signed in. |
Beta Was this translation helpful? Give feedback.
Replies: 9 comments 1 reply
-
The code from import NextAuth from "next-auth"
import GithubProvider from "next-auth/providers/github"
export default NextAuth({
debug: true,
providers: [
GithubProvider({
clientId: process.env.GITHUB_ID,
clientSecret: process.env.GITHUB_SECRET,
}),
],
theme: {
colorScheme: "light",
},
callbacks: {
async jwt({ token }) {
token.userRole = "admin"
return token
},
},
}) |
Beta Was this translation helpful? Give feedback.
-
This is an |
Beta Was this translation helpful? Give feedback.
-
GitHub works well on our deployed example at: https://next-auth-example.vercel.app/ so I suspect this is a configuration error. 🤔 More logs or the rest of the code would be helpful as asked above. 👍 |
Beta Was this translation helpful? Give feedback.
-
Here are the server logs:
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
It seems like the Not sure how this happened. Your configurations look fine to me 🤔 |
Beta Was this translation helpful? Give feedback.
-
One thing to check: the callback URL. I've seen issues like this in the past (with other OAuth implementations) where the callback URL being incorrect could cause such a thing. On the GitHub side of things, should the callback URL be:
I reckon the 2nd one is right here. |
Beta Was this translation helpful? Give feedback.
-
@radar Check if you are using correct GITHUB_SECRET. I had the same issue because the secret was incorrect. |
Beta Was this translation helpful? Give feedback.
-
@cinemanja My secret was saved on Vercel with an extra line break at the start -- and the callback URL was also set incorrectly. Fixing both of these things has resolved my issue. |
Beta Was this translation helpful? Give feedback.
@cinemanja My secret was saved on Vercel with an extra line break at the start -- and the callback URL was also set incorrectly. Fixing both of these things has resolved my issue.