'Flask Cors not working from Angular APP in python3.10 and macOS
I have read almost all the questions related to flask and flask_cors, and still I have not figured out what is going on.
I created an app with an angular frontend and flask in the backend. It worked perfectly with python3.8 and Ubuntu as the operative system of the computer.
Now, I moved to macOS and python3.10 and the CORS do not allow me to make the requests.
The backend:
...
from flask_cors import CORS
...
app = Flask(__name__)
cors = CORS(app)
The only "weird" thing to take in consideration is that I have added a decorator to check the token in every request as follows.
class Auth:
def check_origin(function):
@wraps(function)
def wrapper():
try:
...
except:
return Response.error("Origin not recognized", 400)
return function()
return wrapper
@app.route("/question", methods=["GET"])
@Auth.check_origin
def get_questions():
...
Thank you for reading!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
