使用Google API访问公共日历,而无需用户登录 [英] Accessing a public calendar using Google API without requiring a user to log in

查看:148
本文介绍了使用Google API访问公共日历,而无需用户登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Google的REST API访问公共日历.

Google的日历API建议我需要OAuth令牌才能访问日历:

https://developers.google.com/google-apps/calendar/auth

但是,我正在访问公共日历,并且正在服务器上进行此操作,因此可以(不必)要求用户进行身份验证.

我正在使用node.js api:

googleapis
  .discover('calendar', 'v3').execute(function(err, client) {
    client.calendar.calendars.get({ calendarId: '***@group.calendar.google.com' })
      .execute(function (err, response) {
        console.log('response from google', response);
      });
  });

这将返回您的客户发出了格式错误或非法的请求.仅此而已."

.calendars.get()之后调用.withApiKey('***')会返回相同的错误.

有什么建议吗?

解决方案

文档多次声明

对Google Calendar API的所有请求都必须由经过身份验证的用户授权.

因此,如果您想使用Google Calendar API,则需要经过身份验证的用户.使用 Passport.js http://imgur.com/UGjPtqp

您可以从以下位置公开访问数据:

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