-1

The front-end app is built on ReactJs and development server is running on http://localhost:3000. The back-end API is built with Flask 2.0.2 and is running on http://localhost:5000

In app.py file, the CORS has been allowed as mentioned in the documentation like:

CORS(app, resources={r"*": {"origins": "*"}})

When I try to submit the login form I still get the following error:

enter image description here

Kestal
  • 173
  • 1
  • 2
  • 10
  • You're getting a 500 Internal Server error. The lack of CORS headers is a side effect of your real error. Deal with the actual error report from the server side code. – Quentin Mar 03 '22 at 10:48

1 Answers1

0

if you Enables CORS on your backend api , it should work. I don't think this is an issue with your react frontend application.

cors is a security measure put in by browsers.

You could bypass the Cross-Origin-Policy with chrome extension but it's not advisable - Try this on your backend API:

  • Ensure you have flask cors installed

  • create a configuration dictionary like this

  • api_v1_cors_config = { "origins": ["http://localhost:5000"] }

You can then set a global cors for your app like this

  • CORS(app, resources={"/api/v1/*": api_v1_cors_config})

// this would allow all methods, origins