browser-go-api/api/decorators.py
2019-10-08 18:03:46 -07:00

13 lines
No EOL
423 B
Python

from flask import Blueprint, request, jsonify, session
def jwt_required():
def decorator(func):
def authorized(*args, **kwargs):
auth_header = request.headers.get('Authorization') or None
if auth_header:
# check secret on auth header
return func(*args, **kwargs)
else:
abort(401)
return authorized
return decorator