I tried implementing the signedurl thing in Google Cloud storage but it gives me the error "SignatureDoesNotMatch"
Can someone please help me in this process... Is there any default acl needs to be added to the bucket on the whole to get the signature thing work?
This is my code
// Signed URL
const SERVICE_ACCOUNT_NAME = '
ararara...@developer.gserviceaccount.com';
const KEY_FILE = '../includes/privatekey.p12';
$expires = time() + 10000;
$string_to_sign = "GET\n"."\n"."\n".$expires."\n\n"."/bucketname/image.gif";
$signer = new Google_P12Signer(file_get_contents(KEY_FILE), "notasecret");
$signature_s = $signer->sign($string_to_sign);
$finalSignature = urlencode(base64_encode($signature_s));
$host = "
https://storage.googleapis.com/bucketname/image.gif";
$url = $host. "?GoogleAccessId=" . SERVICE_ACCOUNT_NAME . "&Expires=" . $expires . "&Signature=".$finalSignature;
I tried changing the host to
https://bucketname.commondatastorage.googleapis.com and
https://livmedia.storage.googleapis.com as suggested by some online(nothing worked) -> everything throws the same error "SignatureDoesNotMatch"