gpt4 book ai didi

oauth-2.0 - OAuth2/Google CalDAV - 用户日历列表

转载 作者:行者123 更新时间:2023-12-05 08:00:36 24 4
gpt4 key购买 nike

我曾经请求 caldav 服务器为给定用户提供所有定义的日历。这适用于 fruux/ownCloud(Sabre) 和经典方法 GCalendar。请求是这样的:

method: PROPFIND  headers:Depth: 1  
urlstr:https://www.google.com/calendar/dav/{theUserName}@gmail.com/
contentType:application/xml
content:
<d:propfind xmlns:d="DAV:" xmlns:cs="http://calendarserver.org/ns/" xmlns:c="urn:ietf:params:xml:ns:caldav">
<d:prop>
<d:resourcetype />
<d:displayname />
<cs:getctag />
<c:supported-calendar-component-set />
</d:prop>
</d:propfind>

迁移到 Google OAuth2 有不同的调用,ulrstr: 会像 https://apidata.googleusercontent.com/caldav/v2/ {校准}/用户
这里的 'calid' 必须是一个特定的日历 [1]有说:

Where calid should be replaced by the "calendar ID" of the calendar to be accessed

意图是获取用户帐户的所有日历!所以这些电话将无济于事。

有什么建议可以让他们进入 Google/CalDAV/V2 世界吗?

君特

另见:[1] https://developers.google.com/google-apps/calendar/caldav/v2/guide

最佳答案

答案评论中的链接已损坏。所以我在这里写了一个有效的答案。

  1. 使用 PROPFIND 查找当前用户的主体。
PROPFIND https://apidata.googleusercontent.com/caldav/v2

<?xml version="1.0" encoding="utf-8" ?>
<D:propfind xmlns:D="DAV:">
<D:prop>
<D:current-user-principal/>
</D:prop>
</D:propfind>

2.PROPFIND calendar-home-set 带有我们在上述请求的响应中获得的主要 URL。

PROPFIND https://apidata.googleusercontent.com/{user-principal-path}

<?xml version="1.0" encoding="utf-8" ?>
<D:propfind xmlns:D="DAV:">
<D:prop>
<C:calendar-home-set xmlns:C="urn:ietf:params:xml:ns:caldav"/>
</D:prop>
</D:propfind>

cf) 另一种使用 REPORT principal-match 查找 calendar-home-set 的方法在我的案例中不起作用。

  1. PROPFIND calendar-home-set,深度 header 值为 1。
PROPFIND https://apidata.googleusercontent.com/{calendar-home-set-path}
Depth: 1

<?xml version="1.0" encoding="utf-8" ?>
<D:propfind xmlns:D="DAV:"
xmlns:C="urn:ietf:params:xml:ns:caldav">
<D:prop>
<D:displayname/>
<D:resourcetype/>
<C:supported-calendar-component-set/>
</D:prop>
</D:propfind>

关于oauth-2.0 - OAuth2/Google CalDAV - 用户日历列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18004654/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com