nextauthjs / nextauthjs/next-auth
Callback dont work with credentials provider (infinite loading)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 28.4k
- Forks
- 4k
- PR merge metrics
- No merged PRs in 30d
Description
Provider type
Credentials
Environment
"next": "14.0.4",
"react": "^18",
"next-auth": "^4.24.5"
Windows
Node 20.10.0
Browser: Brave and Chrome
Reproduction URL
https://github.com/omatheusant/ismafer-pages
Describe the issue
I created a simple custom login page using credentials provider to my enterprise webapplication, its working correctly but i'm having a bug that affects the user experience when I try to do the login in my deployment at vercel: https://ismafer-pages.vercel.app/
When I make the login with the right credentials, the page still loading infinite and nevers execute the callback to the "/", but when I reload the page and put the credentials again it works fine and make the push correctly
i try to use the callbackUrl but doesnt work, so I try to use useRouter to make a push and im still having the asme issue.
How to reproduce
- Open https://ismafer-pages.vercel.app/ (deploy)
- try login with credentials (username: ismafer, password: admin123);
- you'll see the loading infinite
- refresh the page
- try again with the credentials and works correct
Expected behavior
just the callback work correctly at the first time the user try to make the login
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the custom login flow in the reproduction repository and compare its deployed behavior at ismafer-pages.vercel.app with the reported local or first-attempt flow. Trace the credentials sign-in and callback handling, then verify that the first valid login completes navigation to "/" without infinite loading.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nextjs, nodejs, react, typescript
- Domain
- authentication, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100