curl – Google日历“未经授权的WebHook回调频道”错误

curl – Google日历“未经授权的WebHook回调频道”错误,第1张

概述我正在尝试使用Google日历设置推送通知.目前我正在使用 oAuth playground来了解它的工作原理.所以我选择了Calendar API v3,授权它,使用提供的授权代码和访问令牌,并查询以下URI: https://www.googleapis.com/calendar/v3/calendars/[email protected] 我正在尝试使用Google日历设置推送通知.目前我正在使用 oAuth playground来了解它的工作原理.所以我选择了Calendar API v3,授权它,使用提供的授权代码和访问令牌,并查询以下URI: https://www.googleapis.com/calendar/v3/calendars/[email protected]/events/watch.请求包含以下正文:


{
"ID": "154345345-345345345",
"type": "web_hook",
"address": "https://www.somedomain.com/web_hook.PHP"
}

@H_419_22@

我已将域名添加到网站管理员工具以证明所有权,并将其添加到developers console中的“允许域名”列表中.

发送以下请求:


POST /calendar/v3/calendars/[email protected]/events/watch http/1.1
Host: www.GoogleAPIs.com
Content-length: 105
Content-type: application/Json
Authorization: Bearer <some access token>
{
"ID": "154345345-345345345",
"address": "https://www.somedomain.com/web_hook.PHP"
}

@H_419_22@

产生以下响应:


http/1.1 401 Unauthorized
Content-length: 318
X-xss-protection: 1; mode=block
X-content-type-options: nosniff
Expires: Tue,09 Sep 2014 13:22:51 GMT
Server: GSE
Cache-control: private,max-age=0
Date: Tue,09 Sep 2014 13:22:51 GMT
x-frame-options: SAMEORIGIN
Content-type: application/Json; charset=UTF-8
Www-authenticate: Bearer realm="https://accounts.Google.com/AuthSubRequest",error=invalID_token
{
"error": {
"code": 401,
"message": "Unauthorized WebHook callback channel: https://www.somedomain.com/web_hook.PHP",
"errors": [
{
"domain": "global",
"reason": "push.webhookUrlUnauthorized"
}
]
}
}

@H_419_22@

我希望得到一些非常基本但具体的步骤,我需要遵循这些步骤以使其正常运行.谢谢你的帮助.

解决方法 显然,oAuth playground根本没有通过 developers console添加的域的句柄,以验证所提供的webhook已被授权.我设法使用代码,它似乎跟 *** 场一样. 总结

以上是内存溢出为你收集整理的curl – Google日历“未经授权的WebHook回调频道错误全部内容,希望文章能够帮你解决curl – Google日历“未经授权的WebHook回调频道”错误所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/1023646.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存