Python flask_jwt.jwt_required() Examples
The following are 2
code examples of flask_jwt.jwt_required().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
flask_jwt
, or try the search function
.
Example #1
Source File: conftest.py From flask-jwt with MIT License | 6 votes |
def app(jwt, user): app = Flask(__name__) app.debug = True app.config['SECRET_KEY'] = 'super-secret' @jwt.authentication_handler def authenticate(username, password): if username == user.username and password == user.password: return user return None @jwt.identity_handler def load_user(payload): if payload['identity'] == user.id: return user jwt.init_app(app) @app.route('/protected') @flask_jwt.jwt_required() def protected(): return 'success' return app
Example #2
Source File: schema.py From graphql-pynamodb with MIT License | 6 votes |
def graphql_token_view(): view = GraphQLView.as_view('graphql', schema=schema, graphiql=bool(app.config.get("DEBUG", False))) view = jwt_required()(view) return view