osapi.people.get()在Google日历侧边栏小工具中返回404 [英] osapi.people.get() returns 404 in google calendar sidebar gadget

查看:321
本文介绍了osapi.people.get()在Google日历侧边栏小工具中返回404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于带有模块首选项的html型日历侧边栏小工具,

For an html-type calendar sidebar gadget with module prefs,

<Require feature="opensocial-0.9"/>
<Require feature="osapi" />

所有对osapi.http的调用均成功发送,这将导致404响应:

where calls to osapi.http all successfully send, this results in a 404 response:

osapi.people.get({userId:'@viewer'}).execute(function(response) {
    console.log(response);
});

这与osapi.http调用一起包裹在POST中,指向相同的RPC端点,并且post对象符合预期:

This is wrapped in a POST to the same RPC endpoint as the osapi.http calls, with the post object as expected:

[{"method":"people.get","id":"people.get","params":{"userId":"@viewer","groupId":"@self"}}]

当小工具需要opensocial-0.8或opensocial-0.9时,与osapi.http或osapi.people的行为没有差异.我假设此调用不需要身份验证令牌-是这样吗?谷歌日历支持osapi.people吗?

There was no difference in behavior with either osapi.http or osapi.people when the gadget Required either opensocial-0.8 or opensocial-0.9. I assumed that no auth token is required for this call--is that true? Does google calendar support osapi.people?

推荐答案

我改用JS API客户端库,并遵循 OpenID Connect解释) .这将导致

I instead used the JS API Client Library and followed the sequence in Authentication using the Google APIs Client Library for JavaScript. Your scopes can contain either explicit URLs or claims, such as 'openid' (see OpenID Connect explained). This will result in a

GET https://accounts.google.com/o/oauth2/auth?client_id=...

其中请求参数'origin'的网址(例如: https://....opensocial .googleusercontent.com )必须是Google Developers Console中客户端的授权Java来源之一.

where the URL of the request parameter 'origin' (ex: https://....opensocial.googleusercontent.com) must be among your Authorized Javascript origins for your client in Google Developers Console.

返回的authResult应该包含一个access_token.如果不是,则可能是authResult.error_subtype ...

The returned authResult should contain an access_token. If not, then possible causes of authResult.error_subtype...

  • 'origin_mismatch':来源不在授权来源中
  • "access_denied":范围未包含身份URL或"openid"

这篇关于osapi.people.get()在Google日历侧边栏小工具中返回404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆