project/server/services/authentication/authService.js
function fromHeaderOrQuerystring(req) {
  if (req.headers.authorization && req.headers.authorization.split(' ')[0] === 'Bearer') {
    return req.headers.authorization.split(' ')[1];
  } else if (req.query && req.query.token) {
    return req.query.token;
  }
  return false;
}
function fromHeaderOrQuerystring(req) {
  if (req.headers.authorization && req.headers.authorization.split(' ')[0] === 'Bearer') {
    return req.headers.authorization.split(' ')[1];
  } else if (req.query && req.query.token) {
    return req.query.token;
  }
  return false;
}
function fromHeaderOrQuerystring ( req ) { if ( req . headers . authorization && req . headers . authorization . split ( ' ' ) [ 0 ] === 'Bearer' ) { return req . headers . authorization . split ( ' ' ) [ 1 ] ; } else if ( req . query && req . query . token ) { return req . query . token ; } return false ; }
Extracts a JWT from a request header or query string
@param  {Object} req the request object
@return {string}     the token
Extracts a JWT from a request header or query string