After utilizing the same code for a period of 2 years, we are encountering an issue where the picker no longer displays. I have consulted resources on Google Picker API Invalid origin but haven't been able to successfully set the origin value. The code for picker initialization is provided below.
picker = new google.picker.PickerBuilder()
.addView(new google.picker.DocsUploadView().setIncludeFolders(true))
.setOAuthToken(token)
.setDeveloperKey(developerKey)
.setCallback(pickerCallback)
.setOrigin('https://docs.google.com')
.build();
The complete error message reads as follows:
[Report Only] Refused to frame 'https://docs.google.com/' because an ancestor violates the following Content Security Policy directive: "frame-ancestors https://docs.google.com".
3760914899-picker_modularized_opc.js:1112 Uncaught Error: Incorrect origin value. Please set it to - (window.location.protocol + '//' + window.location.host) of the top-most page
at new KJ (3760914899-picker_modularized_opc.js:1112)
at 3760914899-picker_modularized_opc.js:1115
at HTMLDocument.<anonymous> (picker:61)
rpc.js?c=1&container=onepick:127 Invalid rpc message origin. vs https://host45.mydomain.com
The final statement in the error message implies that the origin is either an empty string or undefined.