Replies: 5 comments 11 replies
-
I am also facing the same issue, did it resolved ? |
Beta Was this translation helpful? Give feedback.
-
on version: 4.22.3 it just redirect to default login page which something I do not expect |
Beta Was this translation helpful? Give feedback.
-
im facing same issue someone please help |
Beta Was this translation helpful? Give feedback.
-
Might be worth making sure the callback url in the GitHub/Google Oauth settings, matches the |
Beta Was this translation helpful? Give feedback.
-
After spending days digging into the issue, I found a solution that worked for me: The Problem: The error [next-auth][error][CLIENT_FETCH_ERROR] Unexpected token '<', "<DOCTYPE "... is not valid JSON indicated that an API response is returning HTML instead of JSON. This typically happens when the API request is not being handled correctly and instead returns an HTML page (such as index.html) that starts with . Diagnosis: The most common cause for this is a misconfiguration of routing with Vercel's production environment, where API requests are treated the same way as regular page requests. In your case, the rewrites configuration in vercel.json was redirecting API requests to the application root instead of letting them reach the API endpoints properly. Solution: In my vercel.json file, I had the following code:
I changed it to:
Report: The solution is to adjust the rewrite configuration to ensure that requests to the API endpoints are not redirected to the application root. This configuration ensures that all requests that begin with /api are forwarded to the appropriate API endpoints without redirection, while all other requests continue to be redirected to the application root. |
Beta Was this translation helpful? Give feedback.
-
next - 13.3.2
node - 20.2.5
next-auth - 4.22.1
hi, i have been using next auth in my many projects and it worked fine, but recently for some reason it just stoped working in my latest next 13 version, i am using pages directory. when i call signIn function for credentials it instantly redirects to http://localhost:3000/api/auth/error , no errors in console or terminal, i have set secret and URL in env file. only error i could get from next auth logger callback is following:
. the problem is unclear because it was working just fine, maybe something got updated and that's the problem? i don't know please help.
my [...nextauth].js
import NextAuth from "next-auth";
import CredentialsProvider from "next-auth/providers/credentials";
signIn in login:
Beta Was this translation helpful? Give feedback.
All reactions