Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use 'Google Picker' from many JavaScript origins (subdomains and mapped-domains)

I'm trying to add Google Drive file picker to my web app.

My app uses many subdomains (one for each customer account), and some CNAME domain mapping as well.

Since 'Google Developers Console' limits me to specific 'JavaScript Origins' (no wildcard allowed), I fail while trying to authenticate from a subdomain or mapped-domain.

Tried the following workaround: run the picker from an iframe with an absolute URL. No success with this error:

Incorrect origin value. Please set it to - (window.location.protocol + '//' + window.location.host) of the top-most page

Any ideas or workaround to suggest? Thanks in advance :)

like image 410
aharonidan Avatar asked Mar 09 '14 16:03

aharonidan


1 Answers

You could use a window.open() popup that sits a the same domain every time, then use window.postMessage() to communicate between that page and the page at the subdomain.

like image 120
Oliver Briscoe Avatar answered Oct 15 '22 22:10

Oliver Briscoe