Not working with Credentials provider
See original GitHub issueEnvironment
Nuxi 3.0.0-rc.11 Nuxt 3.0.0-rc.11 with Nitro 0.5.4 @sidebase/nuxt-auth 0.0.1-beta.3
Reproduction
No response
Describe the bug
Thank you for this awesome module, it is the missing piece for the Nuxt universe.
I have try to setup nuxt-auth with the credentials Provider which is the most common type when using a decoupled backend.
this is my auth config in nuxt.config.ts copied from official docs in NextAuth
NUXT_URL = http://localhost/api/auth/
auth: {
nextAuth: {
url: process.env.NUXT_URL,
options: {
secret: process.env.NUXT_SECRET,
providers: [
CredentialsProvider({
// The name to display on the sign in form (e.g. 'Sign in with...')
name: 'Credentials',
// The credentials is used to generate a suitable form on the sign in page.
// You can specify whatever fields you are expecting to be submitted.
// e.g. domain, username, password, 2FA token, etc.
// You can pass any HTML attribute to the <input> tag through the object.
credentials: {
username: { label: 'Username', type: 'text', placeholder: 'jsmith' },
password: { label: 'Password', type: 'password' },
},
async authorize(credentials, req) {
// You need to provide your own logic here that takes the credentials
// submitted and returns either a object representing a user or value
// that is false/null if the credentials are invalid.
// e.g. return { id: 1, name: 'J Smith', email: 'jsmith@example.com' }
// You can also use the `req` object to obtain additional parameters
// (i.e., the request IP address)
// eslint-disable-next-line no-console
console.log(credentials)
const user = { id: '1', name: 'J Smith', email: 'jsmith@example.com' }
if (user) {
// Any object returned will be saved in `user` property of the JWT
return user
}
else {
// If you return null then an error will be displayed advising the user to check their details.
return null
// You can also Reject this callback with an Error thus the user will be sent to the error page with the error message as a query parameter
}
},
}),
],
},
},
Login form its showing but not matter what is the input for username and password it always show the error: “Sign in failed. Check the details you provided are correct.”
the authorize function its never reach when submitting the form.
Is there anything else I am missing in order to make it work
Additional context
No response
Logs
No response
Issue Analytics
- State:
- Created a year ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Credentials Provider Not Firing Session Callback · Issue #3970
Hello,. I'm having trouble with using Credentials Provider where it's not firing the session callback. I've logged the whole process from signin ...
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 >Working with AWS Credentials - AWS SDK for Java 1.x
To make requests to Amazon Web Services, you must supply AWS credentials to the AWS SDK for Java. You can do this in...
Read more >Troubleshoot the Central Credential Provider installation
Uninstall the Central Credential Provider and run the installation again. Option 2: Check whether the specified Credential Provider user has already been ......
Read more >Custom Credential Providers Fails to Load on Windows 10 ...
Therefore, custom credential providers do not take effect. To work around this issue, you'll need to disable the automatic system logon of ...
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
@jorgv checkout 0.0.1-beta.4 -> credentials flow should work. Please give feedback here (:
@zoey-kaiser please update the nuxt auth demo!
Note to both: You will habe to change some stuff, as the way to setup nuxt-auth changed -> please refer to the quick start (and give feedbaxk where applicable (: )
@BracketJohn works perfectly! Thanks so much. I will leave my […].ts in case someone else needs it for Credentials provider: