验证/列入谷歌日历的网站白名单



我正在尝试创建一个门户,用户可以在其中验证他们的Google凭据,然后通过我的网站创建和删除事件来访问他们的Google日历。但是,由于以下错误,我似乎无法在Google开发人员控制台上找到将我的网站列入白名单的位置:

{
"error": "idpiframe_initialization_failed",
"details": "Not a valid origin for the client: https://maxstechandmathsite.azurewebsites.net has not been whitelisted for client ID (my client ID). 
Please go to https://console.developers.google.com/ and whitelist this origin for your project's client ID."
}

我正在使用的JavaScript代码参考了这个Github页面:https://github.com/gsuitedevs/browser-samples/blob/master/calendar/quickstart/index.html。除了必须验证我的网站所有权外,问题还可能是客户端 ID 或 API 密钥不正确。对于 Google 日历,我假设您使用 Google 日历本身的客户端 ID 和 API 密钥,但我是否必须使用我的 Google 登录客户端 ID 进行 OAuth 2.0 授权?我尝试了该客户端 ID,但与 Google 日历客户端 ID 不同,首先没有出现错误消息,所以我认为我走在正确的轨道上。我只是找不到有关此错误的任何Google文档。

事实证明我是对的。启用日历 API 时,我确实必须使用我的 OAuth 2.0 客户端 ID,而不是为我生成的 Google 日历客户端 ID。不仅如此,我还不得不使用我在 Google 开发者控制台上制作的先前 API 密钥。

最新更新