Open bboyz269 opened 1 year ago
+1 Experiencing exactly this.
Any updates? I'm still stuck with this. Feel like I tried everything. I check the default page generated by nextAuth, and nothing different from what I have.
I still have the same problem ... It seems like this is never being taken care of even though a great deal of people are experiencing it. For me rn I literally have no way of getting around it...
It all works in dev mode, but as soon as I spin up my container, my whole application is crashing as there's an infinite amount of connections being spawned
Environment
nextjs13, nextauth@4.20.1
Reproduction URL
See [How to reproduce] & [Sugguestion]
Describe the issue
Vercel put out a warning here regarding using middleware for authentication.
General speaking, if the state of user authentication when next/link do prefetching versus when user actual clicking differs (IE: unauthenticated then user login in another tab), nextjs always use prefetched data which is redirect to
/login
page. That combines with?callbackUrl=
params would leads to infinite redirections.How to reproduce
/login
with callbackUrl params}
Expected behavior
User should be redirected to
/protected
as usual.Workarounds
Mentioned in the warning, dev can work around by render url based on user's authentication status
But that would take aways most of the reasons to use middleware.
Suggestion
When
withAuth
failed to check user authentication (unauthenticated, error), don't cache the response.