Hi:
I'm hosting my service on Appengine managed VM, one of the usage case of my service is that I need to generate some files for users, store it in Google Cloud Storage, and redirect user to the link of the files so that they can download them. i don't want to make the files to be public though, I want them to be available to user for a certain period of time.
I skimmed through the storage API provided in gcloud-golang library and figured signed URL would be what I want, however, I can not make it work, and my guess is that my SignedURLOptions is wrong.
In my signedURLOptions, I set 5 fields:
ClientID: "clientID",
PrivateKey: key,
Method: "GET",
Expires: expires,
ContentType: "application/octet-stream",
clientID is what developer console shows to me, it's a service account. I then download the P12key, convert it to PEM file and use its content as key.
It generates a url for me, but whenever I open that url I get error message:
<Error>
<Code>InvalidAccessKeyId</Code>
<Message>
The User Id you provided does not exist in our records.
</Message>
</Error>
I also tried to put email email address, instead of client id, into "ClientID" field, and then I got
<Error>
<Code>SignatureDoesNotMatch</Code>
<Message>
The request signature we calculated does not match the signature you provided. Check your Google secret key and signing method.
</Message>
<StringToSign>
xxxxxxxxxxxxxxxx
</StringToSign>
</Error>
Any suggestions on how to address this error? Is there anything wrong in the step I use it?
Thanks!