Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

How to secure an endpoint for selected users with Flask-JWT-Extended

from flask import abort
from flask_jwt_extended import current_user

@app.route('/users/<userid:int>/edit')
@jwt_required
def users_edit(userid):
    if userid != current_user.id:
        abort(403)

    # ... handle view for matching user
 
PREVIOUS NEXT
Tagged: #How #secure #endpoint #selected #users
ADD COMMENT
Topic
Name
7+2 =