def METHOD_NAME(api_method):
    @wraps(api_method)
    def check_api_key(*args, **kwargs):
        g.zenodo = None
        try:
            req = request.get_json(force=True)
        except Exception as e:
            logger.error(e, exc_info=True)
            req = request.form.to_dict()
        logger.debug("got request data: {}".format(req))
        try:
            service, userId, apiKey = Util.parseUserId(req.get("userId"))
        except Exception as e:
            logger.error(e, exc_info=True)
            apiKey = Util.loadToken(
                req.get("userId"), "port-zenodo").access_token
        if apiKey is None:
            logger.error("apiKey or userId not found.")
            abort(401)
        logger.debug("found apiKey")
        g.zenodo = Zenodo(apiKey, address=current_app.zenodo_address)
        return api_method(*args, **kwargs)
    return check_api_key