sdoomz / react-google-picker

Google Picker for React
MIT License
45 stars 46 forks source link

Why does it need a server in same domain? #18

Open sbimochan opened 5 years ago

sbimochan commented 5 years ago

I'm building on a separate view. Communication with server using CORS. Google picker opens but gives Error "API Error" and in console "Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://docs.google.com') does not match the recipient window's origin ('http://localhost:3000')." I've whitelisted port 3000 in console.developers.google.com. May I know what other setting you had in google console? because your demo works fine.

irfanlone commented 5 years ago

@sdoomz @sbimochan Similar situation, were you able to find the answer to your question?

sbimochan commented 5 years ago

Nope

chitgoks commented 5 years ago

i also get that error. localhost or remote and i already added both of the urls to the whitelist. im not sure what else is lacking here.

jrgriffiniii commented 4 years ago

I've been working with the Picker outside of the context of a React application, and encountered something very similar.

What I did to resolve the issue was configure a TLS reverse proxy in my localhost environment (please see https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/ and http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass - also note that I used a self-signed certificate for this in https://www.digitalocean.com/community/tutorials/openssl-essentials-working-with-ssl-certificates-private-keys-and-csrs)

I then needed to ensure that the Google Picker API was explicitly enabled for my app on console.developers.google.com: https://console.developers.google.com/apis/library/picker.googleapis.com?q=picker&id=09bbdd0e-d44b-4f13-b185-4f3ed6aa33d7&project=[MY-PROJECT]