Replies: 1 comment
-
From pull request related to discussion. #4788 4788 Previous behavior was to always go to get stuck in signIn redirect loop. Current workaround is to Create a middleware function and pass as first arg of withAuth. This issue with this is that you would have to validate only user login with isAuthorized and handle actual permissions check in the function being fired "onSuccess". Default Behavior remains the same with noUser actions converted to configurable callback with default behavior working as current release. |
Beta Was this translation helpful? Give feedback.
-
Environment
System:
OS: macOS 12.4
CPU: (10) arm64 Apple M1 Pro
Memory: 75.20 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.15.1 - ~/.nvm/versions/node/v16.15.1/bin/node
Yarn: 1.22.15 - ~/.nvm/versions/node/v16.15.1/bin/yarn
npm: 8.11.0 - ~/.nvm/versions/node/v16.15.1/bin/npm
Browsers:
Chrome: 103.0.5060.53
Safari: 15.5
npmPackages:
next: ^12.2.0 => 12.2.0
next-auth: ^4.7.0 => 4.7.0
react: 17.0.2 => 17.0.2
Reproduction URL
https://next-auth-example.vercel.app/me
Describe the issue
##Stuck Infinite loop when using middleware for page authorizing.
If your authorization callback is anything more complex than checking for users to be logged in for example role permissions.
Then it is very easy to get stuck in infinite loop, and current withAuth Config does not allow for easy configuration to change behavior.
How to reproduce
Optional steps:
Required Steps:
Expected behavior
Currently behaves as expected, but not user intuitive. Many people will see this as bug.
#4234
Beta Was this translation helpful? Give feedback.
All reactions