mikenicholson / passport-jwt

Passport authentication using JSON Web Tokens
MIT License
1.97k stars 214 forks source link

Updated fromHeader to set the name to lowercase. #90

Closed joshmeads closed 7 years ago

joshmeads commented 7 years ago
opts.jwtFromRequest = ExtractJwt.fromHeader('Bearer');

The above should work when header is set as 'Bearer', but passport-jwt returns a 401. Required to use ExtractJwt.fromHeader('bearer'); for it to work. This should be case insensitive as headers are.

It's common practice for headers to start with a capital letter. I had that code above wondering why it wouldn't work, this fixed it, could be documented instead but I also saw people on stack overflow wondering why Bearer wouldn't work with fromHeader.

mikenicholson commented 7 years ago

Equivalent to #118 which has been merged.

Closing.