Is there a way to restrict the API endpoint with the @jwt_required decorator looking at only one identity?
Right now, I create the JWT with the identity of an admin user = 1 and standard user = 0. On my route, I have something like this:
@app.route('/add', methods=['POST'])
@jwt_required
def add():
if request.method == 'POST':
if get_jwt_identity()[1] == 1:
Is there a cleaner way to check the jwt_identity and perform whatever is defined there for the route? Not sure if my approach is the best.
Thanks!