Question
Authorization with Spaces using Go
Hello, I’m need a little help with getting all the headers setup so I can get to using Spaces.
I’m doing all of this in Go and I have a few questions.
What would I set the SignedHeaders to, I see in the api docs it has it set to host;x-amz-acl;x-amz-content-sha256;x-amz-date
but I’m not familiar and now sure if that changes depending on what you’re doing or not.
My next question has to do with the Signature, again not 100% on the terminology used and would like a little help getting that going. So if anyone could help me out, that would be great.
Here is the code I currently have:
func SetAuthHeaders(accessKey, yymmdd, region string, req *http.Request) {
credentials := fmt.Sprintf("%v/%v/%v/s3/aws4_request", accessKey, yymmdd, region)
signedHeaders := "host;x-amz-acl;x-amz-content-sha256;x-amz-date"
signature := fmt.Sprintf("")
req.Header.Add("Authorization", "AWS4-HMAC-SHA256")
req.Header.Add("Credential", credentials)
req.Header.Add("SignedHeaders", signedHeaders)
req.Header.Add("Signature", signature)
}
Thanks
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×