Always return "missing credentials"
See original GitHub issueThis is my implementation with coffeescript and Express 4
passport.use new LocalStrategy
usernameField:'emailAddress'
,(username,password,done) ->
console.log('credentials passed to passport' + username + '' + password)
User.findOne emailAddress:username,(err,user) ->
if err then return done(err)
if not user
return done(null,false,message:'Incorrect data')
bcrypt.compare password,user.password, (err,isMatch) ->
if err then return done(err)
if isMatch then return done(null,user)
else return done(null,false,message:'Incorrect data')
#Authenticate user
app.post '/api/v1/auth/login',(req,res,next) ->
passport.authenticate('local',(err,user,info) ->
error = err or info
if error then return res.status(400).json {user:null,state:'failure',error:error}
req.logIn user,(err) ->
if err then return res.status(400).json {user:null,state:'failure',error:err}
res.status(200).json {user:req.user,state:'success'}
) req,res,next
I’m also using a linkedIn-strategy
I testing with an angular app and also with
curl -v -d '{"emailAddress":"test@test.cl","password":"test"}' http://127.0.0.1:8070/api/v1/auth/login --trace-ascii /dev/stdout -H "Content-Type: application/json"
But I only get this
{"user":null,"state":"failure","error":{"message":"Missing credentials"}}
can you see the problem?
Issue Analytics
- State:
- Created 9 years ago
- Comments:17 (1 by maintainers)
Top Results From Across the Web
passport js missing credentials - Stack Overflow
When I run this, i used console.log , output was { message: 'Missing credentials' } , which leads me to believe that the...
Read more >Credentials are missing - Forum - Foglight - Quest Community
Hi,. I'm testing the foglight enterprise and in optimization gives an error "Failed - Credentials are missing". I create a lockbox and then...
Read more >Solved: SharePoint Invalid/missing Credentials
... connection returning the message: "Data source credentials are missing. ... and the error message (particularly in the service) always is something a ......
Read more >Access-Control-Allow-Credentials - HTTP - MDN Web Docs
Note that simple GET requests are not preflighted. So, if a request is made for a resource with credentials, and if this header...
Read more >Missing Credentials" error on my login page using passportjs ...
Coding example for the question "Missing Credentials" error on my login page using ... Sending Push using node-apn always returns Invalid token (8) ......
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
My problem was that I was using bodyParser to parse request body as json:
app.use(bodyParser.json());
If you have an html form and are posting username/password to the server, you need to ask bodyparser to parse urlencoded body:
app.use(bodyParser.urlencoded({ extended: false }));
i do not know if it would be helpful to somebody but : i solved the same problem by checking the password input name , it had a capital P !