Providers.Credentials not work
See original GitHub issueDescribe the bug The Providers.Credentials not work.
Steps to reproduce
- Create a next.js project.
- Follow next-auth example code.
- Change provider to:
Providers.Credentials({
name: 'Credentials',
credentials: {
username: { label: "Username", type: "text", placeholder: "jsmith" },
password: { label: "Password", type: "password" }
},
async authorize(credentials) {
const user = { id: 1, name: 'J Smith', email: 'jsmith@example.com' }
if (user) {
return user
} else {
return null
}
}
}),
- click in
signin button on home
Expected behavior Let the project work
Screenshots or error logs
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - Loaded env from /Users/vitor/Documents/projetos/project/.env
event - compiled successfully
event - build page: /
wait - compiling...
event - compiled successfully
event - build page: /api/auth/[...nextauth]
wait - compiling...
event - compiled successfully
(node:6567) UnhandledPromiseRejectionWarning: TypeError: (0 , _preactRenderToString.default) is not a function
at signin (/Users/vitor/Documents/projetos/project/node_modules/next-auth/dist/server/pages/signin.js:46:44)
at Object.signin (/Users/vitor/Documents/projetos/project/node_modules/next-auth/dist/server/pages/index.js:48:35)
at /Users/vitor/Documents/projetos/project/node_modules/next-auth/dist/server/index.js:188:29
at Generator.next (<anonymous>)
at asyncGeneratorStep (/Users/vitor/Documents/projetos/project/node_modules/next-auth/dist/server/index.js:52:103)
at _next (/Users/vitor/Documents/projetos/project/node_modules/next-auth/dist/server/index.js:54:194)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:6567) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 8)
(node:6567) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Additional context I created a blank project and followed the documentation, but the code simply doesn’t work 😦
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:19 (6 by maintainers)
Top Results From Across the Web
Credentials Provider authorize endpoint not working #280
I'm unable to get the credentials provider endpoint to work - requests to /api/auth/callback/credentials as per https://next-auth.js.org/ ...
Read more >Troubleshoot the Central Credential Provider Installation
The 'CyberArk Application Password Provider' service will not start. Open the console log, APPConsole. log, in the Logs folder, and identify relevant errors....
Read more >My Custom Credentials Provider not working intermittently on ...
My Custom Credentials Provider not working intermittently on Windows 10. I have developed the Credential Provider using Microsoft Sample ...
Read more >Credentials | NextAuth.js
The Credentials provider allows you to handle signing in with arbitrary credentials, such as a username and password, domain, or two factor ...
Read more >next-auth credentials provider server error - Stack Overflow
INVALID_CALLBACK_URL_ERROR means that the callbackUrl provided was either invalid or not defined. See the NextAuth doc for more information.
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
Just an FYI, I updated our example repo and pushed a new release https://github.com/nextauthjs/next-auth/releases/tag/v3.11.2 that will use
5.1.14
, so anyone installingnext-auth@latest
, this issue shouldn’t be possible anymore.FYI: I’ve just released
v5.1.14
which reverts back to the previous commonjs behaviour. Regardless of whether the new behaviour is more correct, we shouldn’t do such breaking changes in a patch release on our end. Sorry for the trouble caused by that. It should be all resolved now withv5.1.14
👍