e头修复浏览器快速入门的Google Calendar API?

时间:2019-05-08 08:57:58

标签: javascript api browser calendar google-calendar-api

我通过浏览器(https://developers.google.com/calendar/quickstart/js)浏览google calendar API。我收到了KeyInvalid的错误消息,

play.api.i18n.Lang

证书遵循:

from support.models import CustomUser

class UsernameIdModelBackend(object):
    def authenticate(self,username,password,uid):

        if username:
            try:
                user = CustomUser.objects.get(username=username)

                if user.check_password(password):
                    return user
            except CustomUser.DoesNotExist:
                    return None
        else:
            try:
                user= CustomUser.objects.get(uid=uid)
                return user
            except CustomUser.DoesNotExist:
                return None

     def get_user(self, user_id):
        try:
            return CustomUser.objects.get(pk=user_id)
        except CustomUser.DoesNotExist:
            return None

授权的JavaScript来源:

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

根据文档,我只更改了Client ID: 1046277470516-1at2v7e62v1f2oegqgkodvnbqcg81jlm.apps.googleusercontent.com Client secret: Ey0M3G9JTihM1EHfjjPREiz1 http://localhost http://127.0.0.1 CLIENT_ID等于上面的客户密码。

1 个答案:

答案 0 :(得分:0)

关于您遇到的400个错误请求,

  

“ domain”:“ usageLimits”,“ reason”:“ keyInvalid”,“ message”:“ Bad”   请求”

这意味着您发送的密钥是无效的api密钥。

我认为您的问题类似于此SO post,其中您正在发送客户端密钥作为api密钥,该密钥将无法正常工作,因为首先客户端密钥不是api密钥,而第二个事件是私有用户数据这将要求您首先对用户进行身份验证。