code: def load_user_from_request(req):
      
      load_jws_from_request(req)
      if not hasattr(req, 'jws_header') or req.jws_header is None or not \
              'iat' in req.jws_payload:
          current_app.logger.info("invalid jws request.")
          return None
  
      ln = current_app.bitjws.get_last_nonce(current_app,
                                             req.jws_header['kid'],
                                             req.jws_payload['iat'])
  
      if (ln is None or 'iat' not in req.jws_payload or
              req.jws_payload['iat'] * 1000 <= ln):
          current_app.logger.info("invalid nonce. lastnonce: %s" % ln)
          return None
  
      rawu = current_app.bitjws.get_user_by_key(current_app,
                                                req.jws_header['kid'])
      if rawu is None:
          return None
      current_app.logger.info("logging in user: %s" % rawu)
      return FlaskUser(rawu)
docs: Just like the Flask.login load_user_from_request
  
      If you need to customize the user loading from your database,
      the FlaskBitjws.get_user_by_key method is the one to modify.
  
      :param req: The flask request to load a user based on.