Google Calendar API服务器端访问 [英] Google Calendar API server side access
问题描述
我实现了一个实用程序,使用Google Calendar API和服务器端身份验证流程执行后台操作,无需用户界面。
现在我想从私人日历中读取事件,而不使用授权流程与离线访问或将日历公开。
I implemented an utility to perform background operation using Google Calendar API and server side authentication flow without user interface. Now I would like to read events from a private calendar without using authorization flow with offline access or put calendar public.
我正在使用此代码进行身份验证:
I'm using this code for authentication:
GoogleCredential credential = new GoogleCredential.Builder()
.setTransport(SchedulerCalendar.HTTP_TRANSPORT)
.setJsonFactory(SchedulerCalendar.JSON_FACTORY)
.setServiceAccountId(SchedulerCalendar.SERVICE_ACCOUNT_EMAIL)
.setServiceAccountScopes(SchedulerCalendar.SCOPES)
.setServiceAccountPrivateKeyFromP12File(new File("key.p12")).build();
以下为阅读日历活动:
List eventslist = calendar.events().list(calendarid);
回复为404未找到日历。
The response is 404 for calendar not found.
任何建议?
推荐答案
我将我的问题分享到*@developer.gserviceaccount.com,
和我添加了 http://www.google.com/calendar/feeds/ 请求范围。
I solved my problem sharing the calendar to the *@developer.gserviceaccount.com, and I added http://www.google.com/calendar/feeds/ to scope of the request.
我正在使用的日历也来自Google Apps用户,所以我也添加了我的帐户* .apps.googleusercontent.com - > < a href =http://www.google.com/calendar/feeds/ =nofollow> http://www.google.com/calendar/feeds/ 从Google管理API客户端访问应用程序控制面板。
The calendar that I'm using is also from a google apps user so I add also my account *.apps.googleusercontent.com -> http://www.google.com/calendar/feeds/ to Manage API client access from google apps control panel.
这篇关于Google Calendar API服务器端访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!