Google Picker API出现问题并选择Google Drive项目 [英] Problems with Google Picker API and selecting Google Drive items

查看:182
本文介绍了Google Picker API出现问题并选择Google Drive项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将这个例子
当打开选择器时,我在javascript控制台中得到一个错误,并且对话框提示登录。

 无法将消息发布到https://docs.google.com。收件人有源https://my-app.herokuapp.com。 

点击登录按钮后,弹出窗口打开并立即关闭,但没有任何反应。



当关闭对话框时,javascript控制台中会出现另一个错误

 未知的RPC服务:选择器

我不太确定是什么导致了这些错误,它。



编辑
有人能让我朝正确的方向发展吗?


用户登录到应用程序。另外,当使用Google Drive界面文件中的打开方式菜单并选择我的应用程序时,我可以访问该文件。 解决方案

您必须将 https://my-app.herokuapp.com 加入授权清单在API控制台中使用Javascript源代码:




  • 转到API控制台: https://code.google.com/apis/console/

  • 从下拉菜单中选择您的项目
  • >
  • 打开标签页API Access

  • 单击编辑设置以查看与客户端对应的Web应用程序客户端部分。 >将URI添加到授权JavaScript起源列表


I am trying to integrate a Google Picker for selecting files from Google Drive following this example.
When opening the picker I get an error in the javascript console and the dialog prompts for a login.

Unable to post message to https://docs.google.com. Recipient has origin https://my-app.herokuapp.com.

When clicking the login button a popup opens and immediately closes again, but nothing happens.

When closing the dialog there is another error in the javascript console

Unknown RPC service: picker 

I am not quite sure what causes these errors or even what to make of it.

Can somebody put me in the right direction?

EDIT
User is logged in to the app. Also, when using "Open with" menu on a file in the Google Drive interface and choose my application, I can access that file.

解决方案

You have to add https://my-app.herokuapp.com to the list of authorized Javascript Origins in the APIs Console:

  • go to the APIs Console: https://code.google.com/apis/console/
  • select your project from the dropdown menu
  • open the tab API Access
  • click on Edit Settings for the Client ID for Web Applications section corresponding to your client
  • add the URI to the list of Authorized JavaScript Origins

这篇关于Google Picker API出现问题并选择Google Drive项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆