I am trying to upload assets to AEM Cloud Service using the Asset Upload feature since the Assets HTTP API for creating assets is deprecated. The documentation I am using is here: https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/assets/admin/dev...
I am getting a successful response for the first step, Initiate Upload and I am using an access token for authentication since this is originating from an external application, per the documentation.
But I am running into an issue with the second step, Upload binary. This second step fails with and without authentication. This request throws a 403 FORBIDDEN response stating: "Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature." The documentation does not call out any authentication and even including an access token in the Upload binary request causes it to fail as well with a 400 BAD_REQUEST with the error: "Authentication information is not given in the correct format. Check the value of Authorization header.". I am using a Local Development access token at the moment.
Here is a code snippet of the Upload Binary step currently.
byte[] fileBytes = IOUtils.toByteArray(file.getInputStream());
HttpEntity<byte[]> request = new HttpEntity<>(fileBytes);
String uploadUri = currentFile.getAsJsonArray("uploadURIs").get(0).getAsString();
ResponseEntity<String> responseEntity = this.restTemplate.exchange(uploadUri, HttpMethod.PUT, request, String.class);
Some questions:
Solved! Go to Solution.
Views
Replies
Total Likes
This issue has been resolved. The second step, Upload Binary, requires the asset's mimeType to be included in the request as part of the Accept header. Doing so resolved the authentication issue.
This issue has been resolved. The second step, Upload Binary, requires the asset's mimeType to be included in the request as part of the Accept header. Doing so resolved the authentication issue.
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies