<commit_before>const passport = require('passport')
const passportJwt = require('passport-jwt')
const userModel = require('../models/users')
const { ExtractJwt, Strategy } = passportJwt

let jwtOptions = {}
jwtOptions.jwtFromRequest = ExtractJwt.fromAuthHeader()
jwtOptions.secretOrKey = process.env.JWT_SECRET

const strategy = new Strategy(jwtOptions, (jwtPayload, next) => {
  userModel.findOne(jwtPayload.username)
    .then(user => {
      next(null, user)
    })
    .catch(err => next(err, false))
})

passport.use(strategy)

module.exports = passport<commit_msg>Make passwport-jwt exract tokens from the query params instea of the AuthHeaders<commit_after>const passport = require('passport')
const passportJwt = require('passport-jwt')
const userModel = require('../models/users')
const { ExtractJwt, Strategy } = passportJwt

let jwtOptions = {}
jwtOptions.jwtFromRequest = ExtractJwt.fromUrlQueryParameter('token')
jwtOptions.secretOrKey = process.env.JWT_SECRET

const strategy = new Strategy(jwtOptions, (jwtPayload, next) => {
  userModel.findOne(jwtPayload.username)
    .then(user => {
      next(null, user)
    })
    .catch(err => next(err, false))
})

passport.use(strategy)

module.exports = passport
{'fraction_non_alphanumeric': 0.1285831285831286, 'fraction_numerical': 0.0, 'mean_word_length': 5.14070351758794, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5475324', 'n_tokens_mistral': 411, 'n_tokens_neox': 394, 'n_words': 80}