Total Complexity | 1 |
Complexity/F | 1 |
Lines of Code | 16 |
Function Count | 1 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
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.fromBodyField('token') |
||
11 | |||
12 | // e.g /change_password?token= |
||
13 | export const jwtBodyFieldStrategy = new JwtStrategy(options, (jwtPayload, next) => { |
||
14 | logger.info('Passport', `${chalk.green('[jwtBodyFieldStrategy]')} payload received: ${jwtPayload}`) |
||
15 | next(null, true) |
||
16 | }) |
||
17 |