Google选取器未使用OAuth令牌

Google Picker not using OAuth token

本文关键字:OAuth 令牌 未使用 选取 Google      更新时间:2023-09-26

GooglePicker似乎没有使用我们传递给它的OAuth令牌来显示。它总是使用用户浏览器上的第一个登录帐户。

我目前正在使用这样的东西构建选择器:

google_identity = { accessToken: 'oauth token', appId: '12345678',
                    email: 'example@example.com' };
picker = new google.picker.PickerBuilder().
             addView(google.picker.ViewId.DOCUMENTS).
             enableFeature(google.picker.Feature.MULTISELECT_ENABLED).
             enableFeature(google.picker.Feature.NAV_HIDDEN).
             setAppId(google_identity.appId).
             setOAuthToken(google_identity.accessToken).
             setCallback(pickerCallback).
             build();
picker.setVisible(true);

我是不是错过了什么?我使用的应用程序ID是一系列数字(这似乎是文档所暗示的),我非常确信我的OAuth令牌可以访问Google Drive,因为我在应用程序的其他地方使用该令牌来操作Google Drive上的文件。在构建选择器之前,我还刷新了OAuth令牌,因此该令牌肯定是最新的。

我目前使用的一种解决方法是使用.setAuthUser(google_identity.email)调用,但这并不理想。

这个问题显然已经被谷歌解决了。它现在按预期工作。