jaredhanson/passport-local

jwt malformed message

joetidee opened this issue · 3 comments

Expected behavior

I would expect the message in the http response to match that specified in the done function.

Actual behavior

I receive the following http response:

{"statusCode":401,"error":"Unauthorized","message":"jwt malformed"}
return done(null, false, { message : 'foobar' });

Environment

  • Operating System: Mac OsX
  • Node version: 8.11.1
  • passport version: 0.4.0
  • passport-local version: 1.0.0

This package does not process JWTs, so a message of "jwt malformed" suggests that the error is occurring in application-level code, rather than this package. Could you provide any diagnostics that led you to pinpoint this package as the source of the issue?

This is the full code that I'm running, which is a function that is provided by your package:

const PassportLocalStrategy = require('passport-local').Strategy;

module.exports = new PassportLocalStrategy({
    usernameField: 'email',
    passwordField: 'password',
    session: false,
    passReqToCallback: true,
}, async (req, email, password, done) => {

    try {
       
        return done(null, false, { message : 'foobar' });

    } catch (err) {
        
    }
});

Ok, this error is thrown by jsonwebtoken package