0

enter image description here

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>"
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

1 Answers1

0

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.

Stof
  • 610
  • 7
  • 16