src/helpers/passport/strategies/jwt-empty-param-url-query.js   A
last analyzed

Complexity

Total Complexity 1
Complexity/F 1

Size

Lines of Code 16
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
wmc 1
c 1
b 0
f 0
nc 1
mnd 0
bc 1
fnc 1
dl 0
loc 16
rs 10
bpm 1
cpm 1
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A jwt-empty-param-url-query.js ➔ ??? 0 4 1
1
'use strict'
2
3
import chalk from 'chalk'
4
import { Strategy as JwtStrategy, ExtractJwt } from 'passport-jwt'
5
import config from '../../../../config'
6
import logger from 'winston'
7
8
const options = {}
9
options.secretOrKey = config.jwt.secret
10
options.jwtFromRequest = ExtractJwt.fromUrlQueryParameter('token')
11
12
// e.g /confirmation?token=
13
export const jwtEmptyParamUrlQueryStrategy = new JwtStrategy(options, (jwtPayload, next) => {
14
  logger.info('Passport', `${chalk.green('[jwtEmptyParamUrlQueryStrategy]')} payload received: ${jwtPayload}`)
15
  next(null, true)
16
})
17