TypeError: jwt_required() missing 1 required positional argument: 'fn'
See original GitHub issueWhenever I use the decorator jwt_required() I get this error
	Traceback (most recent call last): 	  File "app.py", line 2, in <module> 	    from api.db import * 	  File "/home/d4vinci/******/******/Project/******/api/db.py", line 51, in <module> 	    @jwt_required() 	TypeError: jwt_required() missing 1 required positional argument: 'fn'
and this is my auth function ` @app.route(‘/api/db/auth’,methods=[‘POST’]) def auth(): if not request.is_json: return jsonify({“msg”: “Missing JSON in request”}), 400
email = request.json.get('email', None)
password = request.json.get('password', None)
if not username:
    return jsonify({"msg": "Missing email parameter"}), 400
if not password:
    return jsonify({"msg": "Missing password parameter"}), 400
if email in [ u.email for u in User.objects.all()]:
    return jsonify({"msg": "Bad username or password"}), 401
elif verify_hash(password,User.objects.filter(email=email).password):
    return jsonify({"msg": "Bad username or password"}), 401
access_token = create_access_token(identity=username+password+"*"*5)
return jsonify(access_token=access_token), 200
`
and the function with the decorator is
 @app.route("/api/db/whoami") @jwt_required() def who():     current_user = get_jwt_identity()     return jsonify(logged_in_as=current_user), 200
`
Issue Analytics
- State:
 - Created 5 years ago
 - Comments:11 (3 by maintainers)
 
Top Results From Across the Web
python decorator TypeError missing 1 required positional ...
Understand what decorator is: @exponential_backoff def test(): pass. equals to: def test(): pass test = exponential_backoff(test).
Read more >wrapper() missing 1 required positional argument: 'fn' - ...
The Python TypeError: init () missing 1 required positional argument occurs when we forget to provide a required argument when instantiating a class....
Read more >flask_jwt — Flask-JWT 0.3.2 documentation
This is done automatically for you by `jwt_required()` but you could call it ... This function receives one positional argument being the JWT...
Read more >API Documentation
The decorated function must take one argument. The argument is the identity that was used when creating a JWT. The decorated function must...
Read more >wrapper() missing 1 required positional argument: 'fn'
TypeError : Register() missing 1 required positional argument: 'request'. Python By Vivek Dhage on May 24 2022. from django.http import JsonResponse from ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Prior to the
4.0.0release of flask-jwt-extended,@jwt_requiredwas the right decorator to use. On version4.0.0and above,@jwt_requried()should be used instead. See https://flask-jwt-extended.readthedocs.io/en/stable/v4_upgrade_guide/ for all the breaking changes of this release.Use
@jwt_requiredinstead of@jwt_required().