This repository was archived by the owner on Aug 14, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 69
Signature invalid when using for "Product Advertising API" #24
Copy link
Copy link
Open
Description
My code is the following:
func (o *AWSHandler) InteractWithMethod(method, u string, values url.Values, header http.Header) (*http.Response, error) {
var req *http.Request
var err error
values.Add("AWSAccessKeyId", o.config["access_key"])
values.Add("Timestamp", time.Now().Format("2006-01-02T15:04:05Z"))
values.Add("SignatureVersion", "3")
if method == "GET" {
req, err = http.NewRequest(method, u+"?"+values.Encode(), nil)
} else {
req, err = http.NewRequest(method, u, bytes.NewBufferString(values.Encode()))
}
req.Header = header
if err != nil {
return nil, err
}
awsauth.SignS3Url(req, time.Now().Add(time.Duration(10)*time.Second), awsauth.Credentials{
AccessKeyID: o.config["access_key"],
SecretAccessKey: o.config["access_secret"],
})
resp, err := o.client.Do(req)
}
And here is the response I get:
<?xml version="1.0"?>
<ItemSearchErrorResponse xmlns="http://ecs.amazonaws.com/doc/2005-10-05/"><Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.</Message></Error><RequestId>227b35f0-bd51-4fe0-9896-aa54c25f5c68</RequestId></ItemSearchErrorResponse>
I'm pretty sure my keys are correct...
Metadata
Metadata
Assignees
Labels
No labels