Skip to content
This repository has been archived by the owner on Aug 14, 2018. It is now read-only.

Signature invalid when using for "Product Advertising API" #24

Open
julienfouilhe opened this issue Feb 14, 2015 · 0 comments
Open

Signature invalid when using for "Product Advertising API" #24

julienfouilhe opened this issue Feb 14, 2015 · 0 comments

Comments

@julienfouilhe
Copy link

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...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant