创建事件时 Apple iCloud CalDAV ‘403 Forbidden’
Apple iCloud CalDAV '403 Forbidden' when creating event
这与 类似,只是已经实施了简单的解决方案(将 UID 添加到 URL)。我从 iCloud CalDAV 服务器收到一个特定用户帐户的“403 Forbidden”。我可以拉取日历列表和日历上的事件,但无法创建或修改事件。
这是一个工作示例:
$ curl -v -X PUT -H "Content-Type:text/calendar" -u "user.x@email.com:zzzz-zzzz-zzzz-zzzz" --data-binary @- https://p34-caldav.icloud.com/xxxxxxxxxx/calendars/{calendarId1}/working-event-1.ics <<EOF
> BEGIN:VCALENDAR
> VERSION:2.0
> BEGIN:VEVENT
> DTSTAMP:20180827T204058Z
> UID:working-event-1
> SUMMARY:Test
> DTSTART;TZID=America/Chicago:20180812
> DTEND;TZID=America/Chicago:20180813
> LOCATION:
> DESCRIPTION:
> LAST-MODIFIED:20180827T204058Z
> END:VEVENT
> END:VCALENDAR
> EOF
* Trying 17.248.142.21...
* TCP_NODELAY set
* Connected to p34-caldav.icloud.com (17.248.142.21) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
* Server certificate: *.icloud.com
* Server certificate: Apple IST CA 2 - G1
* Server certificate: GeoTrust Global CA
* Server auth using Basic with user 'user.x@email.com'
> PUT /xxxxxxxxx/calendars/{calendarId1}/working-event-1.ics HTTP/1.1
> Host: p34-caldav.icloud.com
> Authorization: Basic <redacted>
> User-Agent: curl/7.54.0
> Accept: */*
> Content-Type:text/calendar
> Content-Length: 252
>
* upload completely sent off: 252 out of 252 bytes
< HTTP/1.1 201 Created
< Server: AppleHttpServer/2f080fc0
< Date: Tue, 28 Aug 2018 14:00:12 GMT
< Content-Length: 0
< Connection: keep-alive
< DAV: 1, access-control, calendar-access, calendar-schedule, calendar-auto-schedule, calendar-audit, caldavserver-supports-telephone, calendar-managed-attachments, calendarserver-sharing, calendarserver-subscribed, calendarserver-home-sync
< X-Responding-Server: caldav:33400701:mr22p34ic-ztbu09061801:8001:1815B22:86058e50c4
< X-Transaction-Id: 5c2aa4be-7b79-4bd0-a6d8-39dd2ec7b4b1
< Strict-Transport-Security: max-age=31536000; includeSubDomains
< via: icloudedge:ch41p00ic-zteu03153301:7401:18RC398:Chicago
< X-Apple-Request-UUID: 5c2aa4be-7b79-4bd0-a6d8-39dd2ec7b4b1
< access-control-expose-headers: X-Apple-Request-UUID
< access-control-expose-headers: Via
<
* Connection #0 to host p34-caldav.icloud.com left intact
我按预期收到“201 已创建”和 DAV header
这是一个 non-working 示例(不同的帐户):
curl -v -X PUT -H "Content-Type:text/calendar" -u "user.y@email.com:zzzz-zzzz-zzzz-zzzz" --data-binary @- https://p53-caldav.icloud.com/yyyyyyyyy/calendars/{calendarId2}/not-working-event-1.ics <<EOF
> BEGIN:VCALENDAR
> VERSION:2.0
> BEGIN:VEVENT
> DTSTAMP:20180827T204058Z
> UID:not-working-event-1
> SUMMARY:Test
> DTSTART;TZID=America/Chicago:20180812
> DTEND;TZID=America/Chicago:20180813
> LOCATION:
> DESCRIPTION:
> LAST-MODIFIED:20180827T204058Z
> END:VEVENT
> END:VCALENDAR
> EOF
* Trying 17.248.142.18...
* TCP_NODELAY set
* Connected to p53-caldav.icloud.com (17.248.142.18) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
* Server certificate: *.icloud.com
* Server certificate: Apple IST CA 2 - G1
* Server certificate: GeoTrust Global CA
* Server auth using Basic with user 'user.y@email.com'
> PUT /yyyyyyyyy/calendars/{calendarId2}/not-working-event-1.ics HTTP/1.1
> Host: p53-caldav.icloud.com
> Authorization: Basic <redacted>
> User-Agent: curl/7.54.0
> Accept: */*
> Content-Type:text/calendar
> Content-Length: 256
>
* upload completely sent off: 256 out of 256 bytes
< HTTP/1.1 403 Forbidden
< Server: AppleHttpServer/2f080fc0
< Date: Tue, 28 Aug 2018 14:01:18 GMT
< Content-Length: 0
< Connection: keep-alive
< X-Apple-Jingle-Correlation-Key: S4UK6BYWHBHAHPOFOJX7APFQXU
< apple-seq: 0
< apple-tk: false
< Apple-Originating-System: UnknownOriginatingSystem
< X-Responding-Instance: caldavj:45301001:pv43p53ic-zteg03082001:8501:1815B46:de9f14897
< X-Apple-API-Version: v1
< Strict-Transport-Security: max-age=31536000; includeSubDomains
< via: icloudedge:ch41p00ic-zteu03152101:7401:18RC398:Chicago
< X-Apple-Request-UUID: 9728af07-1638-4e03-bdc5-726ff03cb0bd
< access-control-expose-headers: X-Apple-Request-UUID
< access-control-expose-headers: Via
<
* Connection #0 to host p53-caldav.icloud.com left intact
我收到“403 Forbidden”,没有 'DAV' header,还有几个新的 header。用户表示他们可以正常使用 iCal 应用程序,而且他们似乎对日历具有写入权限。有什么想法吗?
有趣的是,在过去的几天里,这似乎成为 所有 Apple 帐户的问题。显然,Apple 的服务器现在需要 VCALENDAR 对象上的 PRODID 字段......像这样:
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//MyProductId//EN
BEGIN:VEVENT
DTSTAMP:20180827T204058Z
UID:not-working-event-1
SUMMARY:Test
DTSTART;TZID=America/Chicago:20180812
DTEND;TZID=America/Chicago:20180813
LOCATION:
DESCRIPTION:
LAST-MODIFIED:20180827T204058Z
END:VEVENT
END:VCALENDAR
以前它只影响一些帐户,但从最近两天开始,它给每个人都带来了错误,以下解决方案对我有效 -:
我已经在使用 PRODID。我正在使用 ical.net 库来创建 ics,并在设置状态时确认它创建了带有 "STATUS:Confirmed" 文本的 ics 以创建事件,方法是手动将 "STATUS:Confirmed" 更改为 "STATUS:CONFIRMED"成功了。
您也可以将ical.net升级到最新版本,同样可以。但是我遇到了一些问题,所以我坚持使用这个解决方案,直到它得到解决。
这与
这是一个工作示例:
$ curl -v -X PUT -H "Content-Type:text/calendar" -u "user.x@email.com:zzzz-zzzz-zzzz-zzzz" --data-binary @- https://p34-caldav.icloud.com/xxxxxxxxxx/calendars/{calendarId1}/working-event-1.ics <<EOF
> BEGIN:VCALENDAR
> VERSION:2.0
> BEGIN:VEVENT
> DTSTAMP:20180827T204058Z
> UID:working-event-1
> SUMMARY:Test
> DTSTART;TZID=America/Chicago:20180812
> DTEND;TZID=America/Chicago:20180813
> LOCATION:
> DESCRIPTION:
> LAST-MODIFIED:20180827T204058Z
> END:VEVENT
> END:VCALENDAR
> EOF
* Trying 17.248.142.21...
* TCP_NODELAY set
* Connected to p34-caldav.icloud.com (17.248.142.21) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
* Server certificate: *.icloud.com
* Server certificate: Apple IST CA 2 - G1
* Server certificate: GeoTrust Global CA
* Server auth using Basic with user 'user.x@email.com'
> PUT /xxxxxxxxx/calendars/{calendarId1}/working-event-1.ics HTTP/1.1
> Host: p34-caldav.icloud.com
> Authorization: Basic <redacted>
> User-Agent: curl/7.54.0
> Accept: */*
> Content-Type:text/calendar
> Content-Length: 252
>
* upload completely sent off: 252 out of 252 bytes
< HTTP/1.1 201 Created
< Server: AppleHttpServer/2f080fc0
< Date: Tue, 28 Aug 2018 14:00:12 GMT
< Content-Length: 0
< Connection: keep-alive
< DAV: 1, access-control, calendar-access, calendar-schedule, calendar-auto-schedule, calendar-audit, caldavserver-supports-telephone, calendar-managed-attachments, calendarserver-sharing, calendarserver-subscribed, calendarserver-home-sync
< X-Responding-Server: caldav:33400701:mr22p34ic-ztbu09061801:8001:1815B22:86058e50c4
< X-Transaction-Id: 5c2aa4be-7b79-4bd0-a6d8-39dd2ec7b4b1
< Strict-Transport-Security: max-age=31536000; includeSubDomains
< via: icloudedge:ch41p00ic-zteu03153301:7401:18RC398:Chicago
< X-Apple-Request-UUID: 5c2aa4be-7b79-4bd0-a6d8-39dd2ec7b4b1
< access-control-expose-headers: X-Apple-Request-UUID
< access-control-expose-headers: Via
<
* Connection #0 to host p34-caldav.icloud.com left intact
我按预期收到“201 已创建”和 DAV header
这是一个 non-working 示例(不同的帐户):
curl -v -X PUT -H "Content-Type:text/calendar" -u "user.y@email.com:zzzz-zzzz-zzzz-zzzz" --data-binary @- https://p53-caldav.icloud.com/yyyyyyyyy/calendars/{calendarId2}/not-working-event-1.ics <<EOF
> BEGIN:VCALENDAR
> VERSION:2.0
> BEGIN:VEVENT
> DTSTAMP:20180827T204058Z
> UID:not-working-event-1
> SUMMARY:Test
> DTSTART;TZID=America/Chicago:20180812
> DTEND;TZID=America/Chicago:20180813
> LOCATION:
> DESCRIPTION:
> LAST-MODIFIED:20180827T204058Z
> END:VEVENT
> END:VCALENDAR
> EOF
* Trying 17.248.142.18...
* TCP_NODELAY set
* Connected to p53-caldav.icloud.com (17.248.142.18) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
* Server certificate: *.icloud.com
* Server certificate: Apple IST CA 2 - G1
* Server certificate: GeoTrust Global CA
* Server auth using Basic with user 'user.y@email.com'
> PUT /yyyyyyyyy/calendars/{calendarId2}/not-working-event-1.ics HTTP/1.1
> Host: p53-caldav.icloud.com
> Authorization: Basic <redacted>
> User-Agent: curl/7.54.0
> Accept: */*
> Content-Type:text/calendar
> Content-Length: 256
>
* upload completely sent off: 256 out of 256 bytes
< HTTP/1.1 403 Forbidden
< Server: AppleHttpServer/2f080fc0
< Date: Tue, 28 Aug 2018 14:01:18 GMT
< Content-Length: 0
< Connection: keep-alive
< X-Apple-Jingle-Correlation-Key: S4UK6BYWHBHAHPOFOJX7APFQXU
< apple-seq: 0
< apple-tk: false
< Apple-Originating-System: UnknownOriginatingSystem
< X-Responding-Instance: caldavj:45301001:pv43p53ic-zteg03082001:8501:1815B46:de9f14897
< X-Apple-API-Version: v1
< Strict-Transport-Security: max-age=31536000; includeSubDomains
< via: icloudedge:ch41p00ic-zteu03152101:7401:18RC398:Chicago
< X-Apple-Request-UUID: 9728af07-1638-4e03-bdc5-726ff03cb0bd
< access-control-expose-headers: X-Apple-Request-UUID
< access-control-expose-headers: Via
<
* Connection #0 to host p53-caldav.icloud.com left intact
我收到“403 Forbidden”,没有 'DAV' header,还有几个新的 header。用户表示他们可以正常使用 iCal 应用程序,而且他们似乎对日历具有写入权限。有什么想法吗?
有趣的是,在过去的几天里,这似乎成为 所有 Apple 帐户的问题。显然,Apple 的服务器现在需要 VCALENDAR 对象上的 PRODID 字段......像这样:
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//MyProductId//EN
BEGIN:VEVENT
DTSTAMP:20180827T204058Z
UID:not-working-event-1
SUMMARY:Test
DTSTART;TZID=America/Chicago:20180812
DTEND;TZID=America/Chicago:20180813
LOCATION:
DESCRIPTION:
LAST-MODIFIED:20180827T204058Z
END:VEVENT
END:VCALENDAR
以前它只影响一些帐户,但从最近两天开始,它给每个人都带来了错误,以下解决方案对我有效 -:
我已经在使用 PRODID。我正在使用 ical.net 库来创建 ics,并在设置状态时确认它创建了带有 "STATUS:Confirmed" 文本的 ics 以创建事件,方法是手动将 "STATUS:Confirmed" 更改为 "STATUS:CONFIRMED"成功了。
您也可以将ical.net升级到最新版本,同样可以。但是我遇到了一些问题,所以我坚持使用这个解决方案,直到它得到解决。