1

We are using Drive Picker widget to select files in user's Drive.

The app is configured to run as user.

The app works properly when running at https://scripts.google.com/... URL; if we embed the app in a New Google Sites instance (google.com URL), the drive picker shows an empty, white dialog only.

We have some errors in Chrome's Console:

Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://docs.google.com') does not match the recipient window's origin [...]

Invalid 'X-Frame-Options' header encountered when loading [...] 'ALLOW-FROM https://script.google.com' is not a recognized directive. The header will be ignored.

Uncaught Error: Incorrect origin value. Please set it to - (window.location.protocol + '//' + window.location.host) of the top-most page at new JJ (13808338-picker_modularized_opc.js:975) at _createPicker (13808338-picker_modularized_opc.js:977) at HTMLDocument.

Firefox says

Load denied by X-Frame-Options: https://script.google.com/ does not permit framing by https://sites.google.com/s/[...]/edit?authuser=0.

We cannot find any clue about restrictions and limitations in Drive Picker's docs.

Thank you.

Kos
  • 4,890
  • 9
  • 38
  • 42
sbibiz
  • 133
  • 8
  • Have you enabled the option in the app settings to allow the app to be embedded in an iFrame? Perhaps that will change those cross origin settings to allow what you're trying. – Rherma Jul 17 '18 at 17:47
  • Hello Rherma, thank you for answering. Yes the option in the app settings is enabled. Other widgets work properly. Drive Picker only won't work. – sbibiz Jul 17 '18 at 20:26
  • 1
    Then you may be out of luck. The cross origin settings are provided by the webserver in the form of a header which you can't control in App Maker. I ran into a similar issue when trying to redirect to other apps programmatically. If they were to whitelist the correct App Maker/Google script domains I believe it would work. If anyone else knows better, though, please chime in. – Rherma Jul 17 '18 at 21:55

1 Answers1

3

I run App Maker on my bare domain and have picker widget working.

  1. In App Settings: Check Allow embedding app
  2. In Drive Picker's onPickerInit: pickerBuilder.setOrigin("https://example.com/");
Kos
  • 4,890
  • 9
  • 38
  • 42
Andrew Miller
  • 544
  • 3
  • 5