1 year ago
#303325
jaal kamza
Flask cors not allowing request from my react web app (even with cors enabled)
im having many issues with my backend flask API with CORS. I have done everything which flask documentation and stackover flow says, but I still get this error. Even with cors enabled. Anyone know what is wrong?
Even adding the flask decorator for cross_origin
doesn't resolve the issues
from flask import Flask, render_template, request, session, redirect, jsonify, abort
from flask_cors import CORS
import pymongo
from config import get_env_var
from utils import get_token, get_user_information
app = Flask(__name__)
CORS(app)
@app.route("/oauth/discord", methods=["POST"])
def oauth():
Access to XMLHttpRequest at 'http://127.0.0.1:5000/oauth/callback' from origin 'http://127.0.0.1:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.
python
flask
flask-cors
0 Answers
Your Answer