from flask import Flask, jsonify from flask_cors import CORS from flask_jwt_extended import create_access_token, jwt_required, JWTManager app = Flask(__name__) CORS(app) app.config["JWT_SECRET_KEY"] = "fooooooooooooo" jwt = JWTManager(app) @app.route("/products/", methods=["GET"]) @jwt_required() def get_all_products(): return [ {"id": 1, "name": "pinco"}, ] @app.route("/login/", methods=["GET"]) def login(): access_token = create_access_token(identity='muflone') return jsonify(access_token=access_token) if __name__ == "__main__": app.run()