Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
336 views
in Technique[技术] by (71.8m points)

How can you download the feed processing report from a S3 presigned URL (Amazon Feed API)

I am using the below code Step 6 from the link https://github.com/amzn/selling-partner-api-docs/blob/main/guides/use-case-guides/feeds-api-use-case-guide-2020-09-04.md#step-5-get-information-for-retrieving-the-feed-processing-report

        string path = Path.GetTempPath();
        IRestRequest restRequest = new RestRequest(Method.GET);        
        RestClient restClient = new RestClient(presignedurl);
        byte[] response = restClient.DownloadData(restRequest);            
        File.WriteAllBytes(@path + "\words123.txt"  , response);
        

The txt file returns Signature mismatch Error

SignatureDoesNotMatchThe request signature we calculated does not match the signature you provided. Check your key and signing method.AWS4-HMAC-SHA256 20210127T204937Z 20210127/eu-west-1/s3/aws4_request 41 57 53 34 2d 48 4d 41 43 2d 53 48 41 32 35 36 0a 32 30 32 31 30 31 32 37 54 32 30 34 39 33 37 5a 0a 32 30 32 31 30 31 32 37 2f 65 75 2d 77 65 73 74 2d 31 2f 73 33 2f 61 77 73 34 5f 72 65 71 75 65 73 74 0a 64 66 34 62 62 66 61 65 66 64 66 34 30 39 30 36 38 64 32 31 37 64 33 35 62 39 30 64 39 39 38 65 62 64 61 37 39 31 61 64 65 33 66 38 36 66 32 38 61 30 64 34 65 62 34 35 37 65 66 37 63 62 37 33GET //NinetyDays/amzn1.tortuga.3.3bec27f6-e87b-493a-ae7f-fab8a639382f.T2P4950ASWH2IA X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=%2F20210127%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Date=20210127T204937Z&X-Amz-Expires=300&X-Amz-SignedHeaders=content-type%3Bhost content-type: host:tortuga-prod-eu.s3-eu-west-1.amazonaws.com content-type;host UNSIGNED-PAYLOAD47 45 54 0a 2f 2f 4e 69 6e 65 74 79 44 61 79 73 2f 61 6d 7a 6e 31 2e 74 6f 72 74 75 67 61 2e 33 2e 33 62 65 63 32 37 66 36 2d 65 38 37 62 2d 34 39 33 61 2d 61 65 37 66 2d 66 61 62 38 61 36 33 74 2d 31 2e 61 6d 61 7a 6f 6e 61 77 73 2e 63 6f 6d 0a 0a 63 6f 6e 74 65 6e 74 2d 74 79 70 65 3b 68 6f 73 74 0a 55 4e 53 49 47 4e 45 44 2d 50 41 59 4c 4f 41 44DD34A4A3A3CC0692AkCloh5JBLZKUaoKBjA9hFvoLYKjT+SG6E+oMy1pDHRhS7miIYw6/91bBN4eJCuGp9fkpTiEcPg=

question from:https://stackoverflow.com/questions/65928153/how-can-you-download-the-feed-processing-report-from-a-s3-presigned-url-amazon

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Just for security purposes always redact the names of the private resource like in this acute case your s3 bucket name

From the error seems like your presignedUrl is not correct. This specific part.

X-Amz-SignedHeaders=content-type%3Bhost content-type: host:tortuga-prod-eu.s3-eu-west-1.amazonaws.com content-type;host UNSIGNED-PAYLOAD47 45 54 0a

this guide Signing AWS requests with Signature Version 4 can help you signing step of the request by step just to understand the process. In end, you have a URL like:

https://iam.amazonaws.com?Action=ListUsers&Version=2010-05-08&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDEXAMPLE%2F20150830%2Fus-east-1%2Fiam%2Faws4_request&X-Amz-Date=20150830T123600Z&X-Amz-Expires=60&X-Amz-SignedHeaders=content-type%3Bhost&X-Amz-Signature=37ac2f4fde00b0ac9bd9eadeb459b1bbee224158d66e7ae5fcadb70b2d181d02

Not sure if checked this Generating a presigned object URL, there is a nice example of java.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...