I have a document on my firebase storage that I'm sharing with 3rd party. The document shares correctly and 3rd party can read but 3rd party can't write.
const handleSave = async (_blob: Blob) => {
// Log the writeToken to the console
console.log('Write Token:', share.writeToken);
// create storage file using signed url from share.token
try {
const response = await fetch(share.writeToken, {
method: 'PUT',
body: _blob,
});
if (!response.ok) {
console.error('PUT request failed:', response.status, response.statusText);
const errorText = await response.text();
console.error('Error details:', errorText);
}
} catch (err) {
console.error(err);
}
}
I keep getting this error
Shared.tsx:34 PUT request failed: 403
handleSave @ Shared.tsx:34
await in handleSave (async)
Shared.tsx:36 Error details: <?xml version='1.0' encoding='UTF-8'?><Error><Code>SignatureDoesNotMatch</Code><Message>Access denied.</Message><Details>The request signature we calculated does not match the signature you provided. Check your Google secret key and signing method.</Details><StringToSign>PUT
my
developer.gserviceaccount.com has storage Admin access
My firebase storage rules is configuured for read and write access
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if true;
}
}
}
my cors.json is configured like this
[
{
"origin": ["*"],
"method": ["GET", "PUT", "HEAD"],
"maxAgeSeconds": 3600,
"responseHeader": ["Content-Type", "Authorization"]
}
]