Credentials does not work with `strategy` = `database`
See original GitHub issueDescription 🐜
Credentials don’t seem to work with strategy database and just tries to create a JWT token
Is this a bug in your own project?
No
How to reproduce ☕️
- Use Credentials provider
- Use strategy database
Screenshots / Logs 📽
No response
Environment 🖥
System:
OS: macOS 12.0.1
CPU: (8) x64 Apple M1
Memory: 86.30 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
Yarn: 1.22.15 - /usr/local/bin/yarn
npm: 8.3.2 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Browsers:
Chrome: 97.0.4692.99
Firefox: 94.0.1
Safari: 15.1
npmPackages:
next: ^12.0.7 => 12.0.7
next-auth: ^4.1.2 => 0.0.0-semantically-released
react: ^18.0.0-rc.0 => 18.0.0-rc.0
Contributing 🙌🏽
Yes, I am willing to help solve this bug in a PR
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
6 steps for when remote desktop credentials are not working By
1. Make sure the credentials are correct ... The first step in troubleshooting the problem should always be to make sure that the...
Read more >Set Credential & Connection Information for Report Data ...
A report server uses credentials to connect to external data sources that provide content to ... Credentials are not stored in the report....
Read more >Next-Auth credentials not returning session and not storing ...
The CredentialsProvider is not compatible with Database Sessions. In order for credentials to work, you need to configure Next-Auth to use ...
Read more >How to use Database Authentication in MicroStrategy 9.4.x
When the user selects a project, the credentials entered in step 1 are sent to the Intelligence Server for database authentication. The user...
Read more >Configure credentials for an individual SQL Server resource
You can configure credentials to perform data protection jobs on individual SQL Server resource for each user. While you can configure the ...
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

This is intended: https://next-auth.js.org/providers/credentials
We discourage the flow in general.
More people having issues which I think all are related to sessions not being supported for Credentials: https://github.com/nextauthjs/next-auth/issues/3970 https://github.com/nextauthjs/next-auth/discussions/3787
I somewhat understand using credentials is discouraged but at the of the day, most of the web still is and will continue to use password-based logins. Almost all providers next-auth implements in the end boil down to credentials being used in the provider’s ecosystem. For that reason it’s not a surprise many people start implementing credentials with next-auth.
I don’t really see what makes using the database session with credentials that much different then JWT. If intentional, why is one supported and the other one is not?
Inside https://github.com/nextauthjs/next-auth/blob/main/packages/next-auth/src/core/routes/callback.ts#L329 it seems almost all code should be there to get this to work, it’s mostly just that the callbackHandler() is never called for the credentials.