authentication_app_react_django_rest icon indicating copy to clipboard operation
authentication_app_react_django_rest copied to clipboard

Blocked by CORS policy

Open birtasu opened this issue 2 years ago • 2 comments

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

birtasu avatar Sep 03 '23 11:09 birtasu

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

martinbouhier avatar Sep 06 '23 03:09 martinbouhier

@birtasu

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

mbenencase avatar Jan 13 '24 01:01 mbenencase