iOS Development
android – Error Code 403 | Fetch Objects from iCloud Calendar by CalDAV | Flutter

I’m utilizing Flutter and Dart so as to fetch Objects from my iCloud calendar by CalDAV protocol. I’ve already created an app-specific-password for my Apple account, certainly i’m utilizing that password so as to login, i’m able to carry out appropriately each step contained in the “Retrieving calendar info” part as proven on this information, however i can not proceed and fetch the objects as i get the error code 403.
The 403 Forbidden error signifies that the server understands the
request however cannot present extra entry.
That is the code i’m at the moment utilizing. I’m not positive if i needed to embrace the c-tag contained in the request or not.
That is the official documentation of CalDAV.
Future<http.Response> fetchObjects() async {
ultimate request = http.Request(
'REPORT',
Uri.parse('https://pXXX-caldav.icloud.com:XXX/3XX91XX0X/calendars'),
);
request.headers['Authorization'] =
'Fundamental ' + base64Encode(utf8.encode('$appleId:$password'));
request.headers['Depth'] = '1';
request.headers['Prefer'] = 'return-minimal';
request.headers['Content-Type'] = 'utility/xml; charset=utf-8';
ultimate physique=""'
<c:calendar-query xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:caldav">
<d:prop>
<d:getetag />
<c:calendar-data />
</d:prop>
<c:filter>
<c:comp-filter title="VCALENDAR" />
</c:filter>
</c:calendar-query>
''';
request.physique = physique;
ultimate response = await request.ship();
// Convert the StreamedResponse to a Response.
ultimate convertedResponse = await response.stream.toBytes();
ultimate parsedResponse =
http.Response.bytes(convertedResponse, response.statusCode);
print(parsedResponse.statusCode);
print(parsedResponse.physique);
return parsedResponse;
}
Credit: www.ismmailgsm.com