【发布时间】:2021-10-26 21:42:46
【问题描述】:
我们已经使用相同的代码大约 2 年了,现在它不再允许选择器显示。我查看了Google Picker API Invalid origin,但似乎无法实际设置原始值。选择器初始化如下。
picker = new google.picker.PickerBuilder()
.addView(new google.picker.DocsUploadView().setIncludeFolders(true))
.setOAuthToken(token)
.setDeveloperKey(developerKey)
.setCallback(pickerCallback)
.setOrigin('https://docs.google.com')
.build();
完整的错误是
[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
最后一行表明原点是空字符串或未定义。
【问题讨论】: