Reputation: 11
When I enable @jwt_required
on all my routes in users.py, running __init__.py
fails and shows assertion error. If I enable @jwt_required
only on 1 of the routes (doesn't matter which one), the flask app succeeds in building. This is for a flask-react app.
from flask import Blueprint, request
from flask_jwt_extended import jwt_required
users = Blueprint('users', __name__)
@users.route('/profile', methods=['GET'])
@jwt_required
def profile():
return "<p>Profile</p>"
@users.route('/settings', methods=["PUT"])
@jwt_required
def settings():
return "<p>Settings</p>"
Upvotes: 0
Views: 245
Reputation: 1
add the endpoint parameter ( endpoint='<func_name>') to route annotation. It worked for me.
Upvotes: 0
Reputation: 670
where is the call to create_access_token
? have you seen the examples for the lib yet? Your app hasn't shown much about the usage yet, where are tokens coming from, how are they generated, etc.
You probably should just take a working example from the lib docs, and if you can't get the official working example, working, create a issue on the lib repo.
Bet to ask a SO question when you have specific things, than basic getting started that are more appropriate for the lib repo. If that fails ask here and show what you tried yourself to help solve the issue before asking SO.
Upvotes: 0