dotja / authentication_app_react_django_rest

Authentication app using React and Django REST framework
102 stars 51 forks source link

Blocked by CORS policy #1

Open birtasu opened 1 year ago

birtasu commented 1 year ago

Hello.

When I submit the form I get the following error: Access to XMLHttpRequest at 'http://127.0.0.1:8000/api/register' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Please help to solve the problem

martinbouhier commented 1 year ago

I think the problem is the SECRET_key into .env file. The settings.py file can't read this file so if you print the SECRET_KEY value is none

mbenencase commented 10 months ago

@birtasu

I solved it by: https://stackoverflow.com/a/30956822