verify = function verify(error, token) {
    if (!(_.isEmpty(error) && token !== -1)) {
      return response.json(401, {message: 'Given authorization token is not valid', logout: true});
    } else {
      // Store user id to request object
      request.token = token;

      // We delete the token from query and body to not mess with blueprints
      request.query && delete request.query.token;
      request.body && delete request.body.token;

      return next();
    }
  }
Helper function to process possible error and actual token after it is decoded.

@param   {{}}      error Possible error
@param   {Number}  token Decoded JWT token data
@returns {*}