nextauthjs / nextauthjs/next-auth
Credential provider with custom sign in page and a hostname with `signin` word gets replaced by `callback`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 28.4k
- Forks
- 4k
- PR merge metrics
- No merged PRs in 30d
Description
Environment
System:
OS: macOS 15.3.2
CPU: (8) arm64 Apple M1 Pro
Memory: 155.50 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.13.1 - ~/.nvm/versions/node/v22.13.1/bin/node
Yarn: 1.22.22 - ~/.nvm/versions/node/v22.13.1/bin/yarn
npm: 10.9.2 - ~/.nvm/versions/node/v22.13.1/bin/npm
pnpm: 10.1.0 - ~/.nvm/versions/node/v22.13.1/bin/pnpm
Browsers:
Chrome: 138.0.7204.169
Safari: 18.3.1
npmPackages:
@auth/unstorage-adapter: ^2.0.0 => 2.10.0
next: ^14.2.28 => 14.2.28
next-auth: 5.0.0-beta.22 => 5.0.0-beta.22
react: ^18.2.0 => 18.3.
Reproduction URL
https://github.com/rachirib/next-auth-example-signin
Describe the issue
When a credentials provider is setup with a custom login page and its hostname that has the word signin, the authentication workflow gets broken because the word is replaced by callback.
We found out about this because we have a vercel environment and I created a branch with signin and the entire authentication system was not functioning correctly.
This piece of code it might be related
https://github.com/nextauthjs/next-auth/blob/39dd3b92de194c1a835f2d87631f4deb9d9fdf65/packages/next-auth/src/lib/actions.ts#L65-L67
How to reproduce
https://github.com/rachirib/next-auth-example-signin?tab=readme-ov-file#reproduction-steps
Expected behavior
I'm not sure the intention of this replacement code,
but it might be that the hostname should not be replaced so authentication call can flow in the right domain.
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
Read packages/next-auth/src/lib/actions.ts around lines 65-67 and inspect how the sign-in hostname is transformed. Run the reproduction steps in the linked next-auth-example-signin repository; the issue is done when a hostname containing signin is preserved and the credentials authentication flow works on the custom sign-in page.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nextjs, react, typescript
- Domain
- authentication
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100