Callback hell (?)
See original GitHub issueWhen auth fails, it goes back to the site it was called from, and so we end up having something like
http://localhost:3000/?callbackUrl=http://localhost:3000/?callbackUrl=http://localhost:3000/
and it will keep adding the callbackUrl
again and again…
would you mind doing something to prevent this from happening?
thanks in advance
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Callback Hell
The cause of callback hell is when people try to write JavaScript in a way where execution happens visually from top to bottom....
Read more >What to understand Callback and Callback hell in JavaScript
Callback Hell : Callback Hell is essentially nested callbacks stacked below one another forming a pyramid structure. Every callback depends/waits ...
Read more >How to deal with nested callbacks and avoid “callback hell”
Constructing a callback hell · Get ingredients (we're gonna assume it's a beef burger) · Cook the beef · Get burger buns ·...
Read more >Callback Hell and How to Rescue it
Callbacks is a great way of handling asynchronous behavior in javascript. In JavaScript, everything behaves like an object so functions have the ...
Read more >Saved from Callback Hell
Callback hell is real. Developers often see callbacks as pure evil, even to the point of avoiding them. JavaScriptʼs flexibility doesn't ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Would you please share the full
next-auth
configuration and your/
page?So it’s a bit hard to debug without a runnable reproduction, but your issue might be here:
You don’t really check if there is already a
callbackUrl
here. I also wonder if auth fails as you mention, shouldn’t there be anerror
query parameter as well in the URL?I think there should be an error parameter, and so you should handle those cases appropriately since you defined a custom sign-in page. See the docs for possible error codes: https://next-auth.js.org/configuration/pages#sign-in-page
And here is the default sign-in page and error messages for reference:
https://github.com/nextauthjs/next-auth/blob/bcb9383aecaee490ba0c4979f3d0f5b0457924a3/src/server/pages/signin.js#L23-L36
(See the whole file for inspiration)
In any case, I am certain it is not a bug in
next-auth
, so I’ll transfer this to discussions. Feel free to ask further if you have more questions.