# Cross-Origin request failed from React

**URL:** https://forum.djangoproject.com/t/cross-origin-request-failed-from-react/29826
**Category:** Forms & APIs
**Created:** [April 4, 2024, 5:27pm UTC](https://forum.djangoproject.com/t/cross-origin-request-failed-from-react/29826 "2024-04-04T17:27:15Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![shaikhsufian](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/shaikhsufian/32/20383_2.png) [@shaikhsufian](https://forum.djangoproject.com/u/shaikhsufian)
#### Post date: [April 4, 2024, 5:27pm UTC](https://forum.djangoproject.com/t/cross-origin-request-failed-from-react/29826/1 "2024-04-04T17:27:15Z")

</div>

I have been struggling with a CORS issue with login form POST request coming from React dev server to my django backend where I am using Django’s LOginView module for login requests API. These are my settings for settings.py CORS\_ALLOW\_METHODS = ( “DELETE”, “GET”, “OPTIONS”, “PATCH”, “POST”, “PUT”, ) CORS\_ALLOW\_HEADERS = ( “accept”, “authorization”, “content-type”, “user-agent”, “x-csrftoken”, “x-requested-with”, ) CORS\_ALLOWED\_ORIGINS = [‘[http://localhost:3000](http://localhost:3000)’,  
]

CORS\_TRUSTED\_ORIGINS = [ ‘localhost:3000’,  
] CSRF\_TRUSTED\_ORIGINS = [‘localhost:3000’,] CORS\_ORIGINS\_WHITELIST = [ ‘localhost:3000’,  
] and for react I am implementing a proxy in package.json “proxy”: “localhost:8000/”, my api for user token retrieval works fine but I believe something is wrong with the CSRF verification. Kindly take a look at the title for the arisen error. Thanks.

I have alreaady tried the settings reffered in documentation : [django-cors-headers · PyPI](https://pypi.org/project/django-cors-headers/) and someone facing the similar problem in the forumas well.
