You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you give your signIn custom page values with the full domain name next-auth will not respect that and will fall into an infinite redirect loop.
I relied on this behaviour in the v4 and I expect it to keep working in v5.
How to reproduce
Add a custom signIn page to next-auth configuration:
The text was updated successfully, but these errors were encountered:
qstyler
added
bug
Something isn't working
triage
Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
labels
Dec 6, 2024
I think you need to use relative paths instead of absolute. If you pass in { pages: { signIn: "/page_name" }} instead, the config should work both in your dev environment and wherever it's deployed.
Servers and browsers generally understand that paths starting with a / are all relative to the domain
but when I try to access a protected route, for example /dashboard, the middleware redirect to
/login?callbackUrl=http%3A%2F%2Flocalhost%3A3000%2Fdashboard
then when i do login with the email and password, my app redirect to the /dashboard view, BUT you still see in the URL
/login?callbackUrl=http%3A%2F%2Flocalhost%3A3000%2Fdashboard
I fixed it by simply deleting the custom login page., BUT i need my custom page, I've tried everything, Youtube Videos, I read the auth js documentation.
Environment
Reproduction URL
https://github.com/qstyler/next-auth-example/blob/main/auth.ts#L61
Describe the issue
When you give your
signIn
custom page values with the full domain namenext-auth
will not respect that and will fall into an infinite redirect loop.I relied on this behaviour in the v4 and I expect it to keep working in v5.
How to reproduce
Add a custom
signIn
page tonext-auth
configuration:Go to the protected resource (
middleware-example
in your example)The location header will have a slash at the beginning. You will either get into an infinite loop or get a 404 message depending on your settings.
Expected behavior
Redirect correctly to the provided full URL of the page. Without a slash.
The text was updated successfully, but these errors were encountered: