jquery - Google 日历 API 中的 "keyExpired"

标签 jquery api calendar key gcal

从今天开始,我的网站与我的 GCal 出现连接问题。 (从一个月起就一直运行良好)。

我通过 jQuery GET 调用 GCal:

https://www.googleapis.com/calendar/v3/calendars/{MY_CALENDAR}/events?key={MY_API_KEY}

响应是(JSON):

{
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "keyExpired",
    "message": "Bad Request"
   }
  ],
  "code": 400,
  "message": "Bad Request"
 }
}

我不明白为什么 key 过期。你能帮我吗?我还没有在 api key 上读过关于固定时间生命周期的内容。我没有超出每日配额。

抱歉我的英语水平。

谢谢。

最佳答案

keyExpired事件由 OAuth 1.0 流程触发:

If the user approves your application's access request, Google issues an authorized request token. Each request token is valid for only one hour. Only an authorized request token can be exchanged for an access token, and this exchange can be done only once per authorized request token.

OAuth 2.0具有不同的不基于时间的到期触发器。

You should write your code to anticipate the possibility that a granted token might no longer work. A token might stop working for one of these reasons:

The user has revoked access.

The token has not been used for six months.

The user changed passwords and the token contains Gmail, Calendar, Contacts, or Hangouts scopes.

The user account has exceeded a certain number of token requests.

引用文献

关于jquery - Google 日历 API 中的 "keyExpired",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14403843/

相关文章:

ios - 如何在日历选择日期 Xcode 上添加文本

android - 如何将闹钟设置为每天在 8 :00am 触发

javascript - 如果文本框留空,则重新填写文本框的文本

python - Django Tastypie 使用 PATCH 或 PUT 请求进行多对多( self )字段更新?

javascript - 如何使用 Vimeo API 获取视频播放暂停状态?

Android:Jelly Bean 或更高版本中的 setIndicatorBounds

iphone - iOS 在应用程序中添加日 View 日历

jquery - 使用 PreventDefault() 时如何在单击按钮时提交表单?

jquery - 如何从 iframe 内部关闭 iframe?

jquery - 显示刚刚单击的元素的文本