django_react_socialauth icon indicating copy to clipboard operation
django_react_socialauth copied to clipboard

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://apis.google.com/_/scs/apps-static/_/js/k=oz.gapi.en_US.sazTpAB7NWc.O/m=auth2/rt=j/sv=1/d=1/ed=1/am=wQE/rs=AGLTcCMGRnMhese6OTxesnN0rDvhruAGIg/cb=gapi.loaded_0. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

Open patilkrunal opened this issue 4 years ago • 8 comments

image image image image

How do i solve this issue?

patilkrunal avatar Dec 27 '20 07:12 patilkrunal

Can you describe what led to this issue?

pratiksinghchauhan avatar Dec 30 '20 13:12 pratiksinghchauhan

the social auth token for google works perfectly when implemented in django via templates. but when implemented it via react frontend it gave this error. i guess in settings.py of django we have corsheaders mentioned. but is there any way to whitelist domains in react so that this Cross-Origin Request Blocked: error can be resolved.

patilkrunal avatar Dec 31 '20 04:12 patilkrunal

Did you try to clone and run the repo?

pratiksinghchauhan avatar Jan 02 '21 14:01 pratiksinghchauhan

I dont actually remember I cloned or directly downloaded. Whats the difference bw these two. any advantages by cloning?

patilkrunal avatar Jan 02 '21 15:01 patilkrunal

No that is the same thing in this context I mean that won't cause this issue. I am not sure why this issue is caused, Did you check you entered the correct domain name in the Google developers website?

pratiksinghchauhan avatar Jan 04 '21 14:01 pratiksinghchauhan

I guess there might be some issues of cors. I'll try that again by following your blog. If the same issue crops up ill share whole code details and also full error details.

patilkrunal avatar Jan 04 '21 15:01 patilkrunal

I have the same problem , react running on localhost:3000 and django localhost:8000 despite of CORS Allow header , the server reject the api call.

Screen Shot 2021-08-19 at 6 22 16 pm

in settings.py I have the below lines already and added crosheaders to INSTALLED_APPS and MIDDLEWARE
ALLOWED_HOSTS = []

CORS_ORIGIN_ALLOW_ALL = True

farshi avatar Aug 19 '21 08:08 farshi

Had a similar problem when using react-google-drive-picker, when I run the UI on port 3000 everything runs smoothly. However when serving static files via port 8000 and django, the google picker popup gets blocked

aag1992 avatar Apr 29 '24 15:04 aag1992