def decorated_function(*args, **kwargs): token = request.args.get('token', None) if token is None: abort(401) validation = oauth2db.check_token(token) if not validation["success"]: abort(401) return function_to_decorate(*args, **kwargs)
def decorated_function(*args, **kwargs): if not "token" in request.json: abort(401) token = request.json['token'] validation = oauth2db.check_token(token) if not validation["success"]: abort(401) return function_to_decorate(*args, **kwargs)