Next auth error!
Answered
sooperman posted this in #help-forum
https://github.com/SaiThanushreddy/Food-app/ here is the repo i had been trying for so much time but couldn't figure out the error i googled and tried chagpt and many other ways but i didn't get it
Answered by Sun bear
You have to move the api route from
api/[...nextauth] to api/auth/[...nextauth]14 Replies
Sun bear
You could try to replace
with
But tbh it would be great if you could say when exactly you get this error 😅 after submitting the login form?
const handler = (req, res) => NextAuth(req, res, authOptions);
export const GET = handler;
export const POST = handler;with
const handler = NextAuth(authOptions);
export { handler as GET, handler as POSTBut tbh it would be great if you could say when exactly you get this error 😅 after submitting the login form?
When i try google sigin i am getting this error if use credentials its working fine
@Sun bear
@sooperman When i try google sigin i am getting this error if use credentials its working fine
Sun bear
You have to move the api route from
api/[...nextauth] to api/auth/[...nextauth]Answer
Sun bear
btw I would change the credentials of your database and google auth. You should never commit the .env file to github. Just put it in .gitignore (in case that are real credentials)
yeah it worked thanks
@Sun bear Now its giving Another error For db
even though it's correct
this was the error i am getting
🥲
@sooperman this was the error i am getting
Sun bear
Did you google the error? First result on google says:
Should be a workaround
https://stackoverflow.com/questions/76583501/missing-state-cookie-in-next-auth-next-js-13-when-using-googleprovider
GoogleProvider({
clientId: process.env.GOOGLE_CLIENT_ID as string,
clientSecret: process.env.GOOGLE_CLIENT_SECRET as string,
authorization: {
params: {},
},
checks: ['none'],
})Should be a workaround
https://stackoverflow.com/questions/76583501/missing-state-cookie-in-next-auth-next-js-13-when-using-googleprovider