【问题标题】:osapi.people.get() returns 404 in google calendar sidebar gadgetosapi.people.get() 在谷歌日历侧边栏小工具中返回 404
【发布时间】:2015-11-19 17:42:41
【问题描述】:

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

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

对 osapi.http 的调用都成功发送,这会导致 404 响应:

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

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

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

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

【问题讨论】:

    标签: google-calendar-api google-oauth google-gadget opensocial


    【解决方案1】:

    我改为使用 JS API 客户端库并遵循Authentication using the Google APIs Client Library for JavaScript 中的顺序。您的范围可以包含显式 URL 或声明,例如“openid”(请参阅​​OpenID Connect explained)。这将导致

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

    其中请求参数“origin”的 URL(例如:https://....opensocial.googleusercontent.com)必须是您在 Google Developers Console 中为您的客户端授权的 Javascript 来源。

    返回的 authResult 应该包含一个 access_token。如果不是,那么 authResult.error_subtype 的可能原因...

    • 'origin_mismatch':来源不在授权来源中
    • “access_denied”:范围不包括身份 URL 或“openid”

    【讨论】:

      猜你喜欢
      • 2010-09-20
      • 2010-12-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多