google-api - Intermittent "The API developer key is invalid" error
问题描述
We have a live application that gives the "The API developer key is invalid" intermittently.
The normal flow:
- User clicks "Import from Google Drive"
- Gets an OAuth screen
- Selects a user (if there are more than one)
- Gets prompted with the Google Picker
- Picks a file
- File gets imported
But for some users, after selecting a user in point 3 (or automatically if there is only one user) the Picker dialog doesn't open, but gets prompted with an "In order to select an item from your online storage, please sign in" message on black background with red Sign in button on it. (see screenshot)
Then after clicking "Sign in", the user receives the "The API developer key is invalid" error message, and the flow stops. (see screenshot again)
For the majority of the users everything works fine. Seems to be a per user issue, because we have an affected user that has multiple gmail addresses signed in into Chrome, and this issue happens with one email address, but doesn't happen with the other.
Any ideas?
解决方案
经过长时间的搜索,我找到了解决方法。我不得不替换gapi.auth2.init
andgapi.auth2. signIn
调用,gapi.auth2.authorize
它也开始为那些受影响的用户工作。向谷歌提交了一份关于它的报告,但在撰写本文时,没有太多回复:https ://github.com/google/google-api-javascript-client/issues/613
推荐阅读
- latex - Latex 定义上市语言
- javascript - 使用对象道具(名称)对js对象进行排序
- python - 如何更新字典列表中的值
- python - 在 Python 中手动计算 XGBoost 模型的概率
- monitor - 如何使用另一个 jar 检查我的 jar 是否仍在 Windows 10 中运行?
- android - 为什么我的文本和按钮不显示并被我的图像覆盖?
- javascript - 在 Express JS 和 Node JS 中使用 Reduce 方法
- node.js - React Native:致命错误:接近堆限制的无效标记压缩分配失败 - React 中的 JavaScript 堆内存不足
- java - 在后台运行测试时出现 TimeoutException
- android - WebResourceResponse 不显示视频